本文整理汇总了TypeScript中lodash/fp.map函数的典型用法代码示例。如果您正苦于以下问题:TypeScript map函数的具体用法?TypeScript map怎么用?TypeScript map使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了map函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: flow
(snippets) => flow([
map('files'),
flattenDeep,
groupBy('language'),
map((language: string[]) => ({
language: get('language', head(language)),
size: size(language)
})),
sortBy('size'),
reverse
])(snippets)
示例2: buildReport
function buildReport (errors) {
const errorLines = _.compose(_.map(buildLine), _.get('details'))(errors)
return {
desc: `检查 Taro 配置 (${PROJECT_CONF_PATH})`,
lines: errorLines
}
}
示例3: pkgsNotInstalled
function pkgsNotInstalled (pkgs) {
const uninstalledPkgs = _.filter(isPkgNotInstalled, pkgs)
const lines = _.map(pkg => Object({
desc: `使用到的依赖 ${pkg.moduleName} 还没有安装`,
valid: false
}), uninstalledPkgs)
return lines
}
示例4: taroCliVersionNotMatch
function taroCliVersionNotMatch (pkgs) {
const pkgsNotMatch = _.filter(pkg => isPkgInstalled(pkg) && isCliVersionNotMatch(pkg), pkgs)
const lines = _.map(pkg => Object({
desc: `${pkg.moduleName} (${pkg.installed}) 与当前使用的 @tarojs/cli (${pkgVersion}) 版本不一致, 请更新为统一的版本`,
valid: false
}), pkgsNotMatch)
return lines
}
示例5: pipe
const getDllReferencePlugins = ({ dllEntry, outputRoot, dllDirectory }) => {
return pipe(
toPairs,
map(([key]) => {
return [`dll${key}`, getDllReferencePlugin(outputRoot, dllDirectory, key)]
}),
fromPairs
)(dllEntry)
}
示例6: map
const prepareFiles = (snippet: Partial<ISnippet>) => {
return map(
(file: IFile) => ({
...file,
collapsed: false,
viewed: toUnixTimeStamp(new Date().getTime()),
language: getFileLanguage(file)
}),
snippet.files
);
};
示例7: loadGraphs
async loadGraphs() {
return this.serverClient
.query({
query: gql`
{
__schema {
queryType {
fields {
name
}
}
}
}
`,
})
.then(fp.get('data.__schema.queryType.fields'))
.then(fp.map(fp.get('name')));
}
示例8: map
const groupedEntitiesFinal = groupedEntities.map(function(
groupedEntity
) {
if (isPvjsonEdge(groupedEntity)) {
groupedEntity.points = map(function(point) {
point.x -= x;
point.y -= y;
return point;
}, groupedEntity.points);
} else if (isPvjsonSingleFreeNode(groupedEntity)) {
groupedEntity.height;
groupedEntity.x -= x;
groupedEntity.y -= y;
} else {
return hl.fromError(
new Error(
`
Encountered unexpected entity
${JSON.stringify(groupedEntity, null, " ")}
in Group
${JSON.stringify(pvjsonGroup, null, " ")}
`
)
);
}
// NOTE: this is needed for GPML2013a, because GPML2013a uses both
// GroupId/GroupRef and GraphId/GraphRef. GPML2017 uses a single
// identifier per entity. That identifier can be referenced by
// GroupRef and/or GraphRef. Pvjson follows GPML2017 in this, so
// we convert from GPML2013a format:
// GroupRef="GROUP_ID_VALUE"
// to pvjson format:
// {isPartOf: "GRAPH_ID_VALUE"}
groupedEntity.isPartOf = id;
return omit(["groupRef"], groupedEntity);
});