本文整理匯總了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);
});