当前位置: 首页>>代码示例>>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;未经允许,请勿转载。