• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript lodash.pickBy函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中lodash.pickBy函数的典型用法代码示例。如果您正苦于以下问题:TypeScript pickBy函数的具体用法?TypeScript pickBy怎么用?TypeScript pickBy使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了pickBy函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: getStandaloneSecondarySections

export function getStandaloneSecondarySections(sysInfoData: SysInfo): SysInfoSection {
  return {
    Web: pickBy(sysInfoData, (_, key) => key.startsWith('Web')) as SysValueObject,
    'Compute Engine': pickBy(sysInfoData, (_, key) =>
      key.startsWith('Compute Engine')
    ) as SysValueObject,
    'Search Engine': pickBy(sysInfoData, (_, key) => key.startsWith('Search')) as SysValueObject
  };
}
开发者ID:christophelevis,项目名称:sonarqube,代码行数:9,代码来源:utils.ts


示例2: getRefPaths

function getRefPaths(obj: object, paths: { [key: string]: any }): { [key: string]: string } {

	// pick because it's an object (map)
	const singleRefsFiltered = pickBy(paths, schemaType => schemaType.options && schemaType.options.ref);
	const singleRefs = mapValues(singleRefsFiltered, schemaType => schemaType.options.ref);

	const arrayRefsFiltered = pickBy(paths, schemaType => schemaType.caster && schemaType.caster.instance && schemaType.caster.options && schemaType.caster.options.ref);
	const arrayRefs = mapValues(arrayRefsFiltered, schemaType => schemaType.caster.options.ref);

	return explodePaths(obj, singleRefs, arrayRefs);
}
开发者ID:freezy,项目名称:node-vpdb,代码行数:11,代码来源:pretty.id.plugin.ts


示例3: getStandaloneSecondarySections

export function getStandaloneSecondarySections(sysInfoData: T.SysInfoBase): T.SysInfoSection {
  return {
    Web: pickBy(sysInfoData, (_, key) => key.startsWith(WEB_PREFIX)) as T.SysInfoValueObject,
    'Compute Engine': pickBy(sysInfoData, (_, key) =>
      key.startsWith(CE_FIELD_PREFIX)
    ) as T.SysInfoValueObject,
    'Search Engine': pickBy(sysInfoData, (_, key) =>
      key.startsWith(SEARCH_PREFIX)
    ) as T.SysInfoValueObject
  };
}
开发者ID:SonarSource,项目名称:sonarqube,代码行数:11,代码来源:utils.ts


示例4: it

 it('#remove', () => {
   let arr = [
     { id: '10' },
     { id: '15' },
     { id: '18' },
     { id: '17' },
     { id: '10', name: 'mo' },
   ];
   console.log(_.find(arr, _.pickBy(route.match('/name=mo'), _.identity)));
   _.remove(arr, _.pickBy(route.match('/10'), _.identity));
   expect(arr.length).toEqual(3);
 });
开发者ID:m0n01i7h,项目名称:axios-cached-resource,代码行数:12,代码来源:lodash.spec.ts


示例5: infer

function infer(argv: IArgv): Stream {
	return argv.stream = handler(argv)
		.pipe(eclint.infer(_.pickBy(argv) as eclint.InferOptions))
		.pipe(tap((file) => {
			console.log(file.contents + '');
		}));
}
开发者ID:jedmao,项目名称:eclint,代码行数:7,代码来源:cli.ts


示例6: async

    return async (dispatch: (action: any) => void, getState: () => GertyState, bundle: Bundle) => {

        const state = getState();

        const process = _.get<Process>(state.data, buildProcessDataPath(globalProcessId));
        const commandCwd = buildCommandCwd(state.configuration, globalProcessId, process.stopCommand);

        const stopCommand = [
            process.stopCommand.executable,
            ...process.stopCommand.parameters,
        ];

        const processManager = bundle.container
            .get<ProcessManager>(gertyDomainSymbols.ProcessManager);

        const deferred = createDeferred();
        const stopCommandPid = await processManager.run(stopCommand, commandCwd);
        processManager.onExit(stopCommandPid, () => deferred.resolve());

        await deferred.promise;

        const processHistoryState = JSON.parse(localStorage.getItem("gerty:process-history")) as ProcessHistoryState || {};

        const updatedProcessHistoryState = _.pickBy(processHistoryState, (processHistories: ProcessHistory[], historicGlobalProcessId: GlobalProcessId) =>
            historicGlobalProcessId !== globalProcessId);

        localStorage.setItem("gerty:process-history", JSON.stringify(updatedProcessHistoryState));
    };
开发者ID:atrauzzi,项目名称:Gerty,代码行数:28,代码来源:StopProcessViaCommand.ts


示例7: describeRoom

export default function describeRoom(room: Cell.Room, map: Map.Map): string {
  let description: string;

  if (Cell.isTreasureRoom(room)) {
    description = 'Behold! The riches of Xanadu!\nYou have found the treasure room!\n';
  } else if (Cell.isPassageRoom(room)) {
    description = 'You have reached a passage room!\n';
  } else {
    description = 'It is a dark room.\n';
  }

  const allNeighbors = Cell.getCardinalNeighboringPositions({
    row: room.row,
    col: room.col
  });

  const pathNeighbors = _.pickBy(allNeighbors, (pos) => Map.isValidRoom(map, pos));

  const pathDirections = _.keys(pathNeighbors);

  if (pathDirections.length === 1) {
    description += `There is one path to the ${pathDirections[ 0 ]}.`;
  } else {
    const dirStr = `${_.initial(pathDirections).join(', ')} and ${_.last(pathDirections)}`;
    description += `There are paths to the ${dirStr}.`;
  }

  return description;
}
开发者ID:zthomae,项目名称:xanadu,代码行数:29,代码来源:describeRoom.ts


示例8: get

export async function get(doi: string): Promise<CSL.Data | ResponseError> {
    const response = await fetch(`https://doi.org/${encodeURIComponent(doi)}`, {
        headers: {
            accept: 'application/vnd.citationstyles.csl+json',
        },
    });
    if (!response.ok) {
        return new ResponseError(doi, response);
    }
    const data: any = _.pickBy<CSL.Data>(
        await response.json(),
        (value, key: any) => {
            if (CSL_KEYS.indexOf(key) === -1) {
                return false;
            }
            if (
                CSL_STRING_KEYS.indexOf(key) >= 0 &&
                typeof value !== 'string'
            ) {
                return false;
            }
            if (
                CSL_NUMBER_KEYS.indexOf(key) >= 0 &&
                typeof value !== 'number'
            ) {
                return false;
            }
            return key !== 'abstract';
        },
    );
    return data;
}
开发者ID:dsifford,项目名称:academic-bloggers-toolkit,代码行数:32,代码来源:doi.ts


示例9: async

    return async (dispatch: (action: any) => void, getState: () => GertyState, bundle: Bundle) => {

        const state = getState();

        const activePids = _.map(state.configuration.processStates, (processState) =>
            processState.pid);

        const processHistoryState = JSON.parse(localStorage.getItem("gerty:process-history")) as ProcessHistoryState || {};

        const orphanedProcesses = _.pickBy(processHistoryState, (processHistories: ProcessHistory[]) =>
            !_.chain(processHistories)
                .map((processHistory: ProcessHistory) => processHistory.pid)
                .flatten()
                .difference(activePids)
                .isEmpty()
                .value());

        const kills = _.chain(orphanedProcesses)
            .map((processHistory: ProcessHistory[], globalProcessId: GlobalProcessId) =>
                dispatch(stopOrphanedProcess(globalProcessId, processHistory)))
            .uniq()
            .value();

        localStorage.setItem("gerty:process-history", JSON.stringify({}));

        await Promise.all(kills);
    };
开发者ID:atrauzzi,项目名称:Gerty,代码行数:27,代码来源:CleanOrphanedProcesses.ts


示例10: getItemRequirementsString

 static getItemRequirementsString(item) {
   const newItem = _.pickBy(item, (val, key) => {
     return _.includes(key, 'Req') && val > 0;
   });
   return _(newItem)
     .map(ItemInfo.parseRequirement)
     .join('\n');
 }
开发者ID:IdleLands,项目名称:Play,代码行数:8,代码来源:iteminfo.ts



注:本文中的lodash.pickBy函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript lodash.pluck函数代码示例发布时间:2022-05-25
下一篇:
TypeScript lodash.pick函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap