當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript array.arrayMap函數代碼示例

本文整理匯總了TypeScript中wherehows-web/utils/array.arrayMap函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript arrayMap函數的具體用法?TypeScript arrayMap怎麽用?TypeScript arrayMap使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了arrayMap函數的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: formatAsCapitalizedStringWithSpaces

const getAccessControlTypeOptions = (
  accessTypes: Array<AccessControlAccessType>
): Array<IAccessControlAccessTypeOption> => {
  const getTypeOption = (value: AccessControlAccessType): IAccessControlAccessTypeOption => ({
    value,
    label: formatAsCapitalizedStringWithSpaces(value)
  });
  return arrayMap(getTypeOption)(accessTypes);
};
開發者ID:alyiwang,項目名稱:WhereHows,代碼行數:9,代碼來源:acl-access.ts

示例2: arrayMap

const keysMatchNames = (object: IObject<any>, typeMaps: Array<IMetadataType>): true => {
  const objectKeys = Object.keys(object).sort();
  const typeKeys = arrayMap((typeMap: IMetadataType) => typeMap['@name'])(typeMaps).sort();
  const objectKeysSerialized = objectKeys.toString();
  const typeKeysSerialized = typeKeys.toString();
  const match = objectKeysSerialized === typeKeysSerialized;

  if (!match) {
    throw new Error(
      `Expected attributes ${typeKeys.join(', ')} on object. Found additional  attributes ${difference(
        objectKeys,
        typeKeys
      ).join(', ')}`
    );
  }

  return match;
};
開發者ID:alyiwang,項目名稱:WhereHows,代碼行數:18,代碼來源:metadata-schema.ts

示例3: arrayMap

 * @return {Pick<IDatasetColumn, "dataType" | "fieldName">}
 */
const columnDataTypeAndFieldName = ({
  dataType,
  fullFieldPath
}: IDatasetColumn | IDatasetColumnWithHtmlComments): Pick<IDatasetColumn, 'dataType' | 'fieldName'> => ({
  dataType,
  fieldName: fullFieldPath
});

/**
 * Takes a list of objects with comments and returns an array of objects with comments or html comments
 * @type {(array: Array<T extends { comment: string } & Object>) => Array<T | T extends { commentHtml: string }>}
 */
const augmentObjectsWithHtmlComments = arrayMap<IDatasetColumn, IDatasetColumnWithHtmlComments | IDatasetColumn>(
  augmentWithHtmlComment
);

/**
 * Takes a list of IDatasetColumn / IDatasetColumn with html comments and pulls the dataType and and fullFieldPath (as fieldName) attributes
 * @type {(array: Array<IDatasetColumn | IDatasetColumnWithHtmlComments>) => Array<Pick<IDatasetColumn, "dataType" | "fieldName">>}
 */
const columnDataTypesAndFieldNames = arrayMap(columnDataTypeAndFieldName);

/**
 * Gets the dataset columns for a dataset with the id specified and the schemaless flag
 * @param {number} id the id of the dataset
 * @return {(Promise<{schemaless: boolean; columns: Array<IDatasetColumn>}>)}
 */
const readDatasetColumns = async (id: number): Promise<{ schemaless: boolean; columns: Array<IDatasetColumn> }> => {
  const { status, columns = [], schemaless, message = datasetColumnsException } = await getJSON<
開發者ID:alyiwang,項目名稱:WhereHows,代碼行數:31,代碼來源:columns.ts

示例4: arrayMap

const datasetsWithComplianceMetadata = (
  datasets: Array<IDatasetView>
): Array<Promise<IUpstreamWithComplianceMetadata>> => arrayMap(datasetWithComplianceMetadata)(datasets);
開發者ID:alyiwang,項目名稱:WhereHows,代碼行數:3,代碼來源:lineage.ts


注:本文中的wherehows-web/utils/array.arrayMap函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。