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

TypeScript ramda.keys函数代码示例

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

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



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

示例1: requestKeys

 /**
  * Given a path somewhere within the tree, list the keys found if it is an object.
  *
  * @param command The command received from the reactotron app.
  */
 function requestKeys(command: any) {
   const trackedNode = trackedNodes[command.mstNodeName || "default"]
   const atPath: string = (command && command.payload && command.payload.path) || []
   if (trackedNode && trackedNode.node && atPath) {
     const state = getSnapshot(trackedNode.node)
     if (isNilOrEmpty(atPath)) {
       reactotron.stateKeysResponse(null, keys(state))
     } else {
       const keyList = keys(dotPath(atPath, state))
       reactotron.stateKeysResponse(atPath, keyList)
     }
   }
 }
开发者ID:nick121212,项目名称:reactotron,代码行数:18,代码来源:reactotron-mst.ts


示例2: keys

const extractSchemaMetaData = (typeDefs: string) => {
  if (!cache.schemaMetaData) {
    const scalars = keys(scalarResolversMap)
    const scalarsPresentInSchema = map(hasScalar(typeDefs), scalars)
    cache.schemaMetaData = zipObj(scalars, scalarsPresentInSchema)
  }
  return cache.schemaMetaData
}
开发者ID:vtex,项目名称:apps-client-node,代码行数:8,代码来源:index.ts


示例3: getImmutableModel

 /**
  * Return a immutable model
  * @param model An object with key value pair
  */
 static getImmutableModel(model) {
   let newModel: any = { };
   const getFields = R.keys();
   const assignFields = field => newModel[field] = model[field];
   const prepareModel = R.pipe(getFields, R.forEach(assignFields));
   prepareModel(model);
   return newModel;
 }
开发者ID:simbiosis-group,项目名称:ion2-helper,代码行数:12,代码来源:record-helper.ts


示例4: init

export const initAll = (element: any): any => {
  if (Array.isArray(element)) {
    return init(element);
    // Check for length of Object.keys, because Dates and null are objects too
  } else if (typeof element === 'object' && keys(element).length > 0) {
    return map(initAll, element);
  }
  return element;
};
开发者ID:linode,项目名称:manager,代码行数:9,代码来源:initAll.ts


示例5: constructor

 constructor(operator$: Stream<string>) {
   const xs = Stream;
   operator$.addListener(dummyListener);
   this.operator$ =
     operator$
       .map(operator => xs.of(operators[operator]))
       .flatten();
   this.operators$ =
     xs.of(keys(operators)).remember();
 }
开发者ID:artfuldev,项目名称:xstream-marbles,代码行数:10,代码来源:operators.ts


示例6: getPidByPidCode

export function getPidByPidCode (pidstring: string) : PID|null {
  let names:Array<string> = keys(PIDS);

  let pidname:string = find((name:string) => {
    let curpid:PID = PIDS[name];

    return curpid.getPid() === pidstring;
  })(names);

  if (pidname) {
    return PIDS[pidname];
  } else {
    return null;
  }
};
开发者ID:evanshortiss,项目名称:obd-parser,代码行数:15,代码来源:index.ts


示例7:

 fields.forEach(field => {
   if (!toFilter) {
     if (R.is(Object, field)) {
       const key = R.head(R.keys(field));
       const value = R.values(field);
       if (key === 'eq') {
         toFilter = (obj[value] === query);
       }
     } else {
       if (!R.isNil(obj[field])) {
         toFilter = obj[field].toString()
           .toLowerCase().indexOf(query) > -1
       }
     }
   }
 });
开发者ID:simbiosis-group,项目名称:ion2-helper,代码行数:16,代码来源:array-helper.ts


示例8: recordTimings

function recordTimings(start: [number, number], name: string, timings: Record<string, [number, number]>, middlewareMetrics: Record<string, [number, number]>) {
  // Capture the total amount of time spent in this middleware
  const end = process.hrtime(start)
  timings[name] = end
  const label = `middleware-${name}`
  metrics.batch(label, end)

  // This middleware has added it's own metrics
  // Just add them to `timings` scoped by the middleware's name and batch them
  const middlewareMetricsKeys: string[] = keys(middlewareMetrics) as string[]
  if (middlewareMetricsKeys.length > 0) {
    forEach((k: string) => {
      const metricEnd = middlewareMetrics[k]
      const metricName = `${label}-${k}`
      timings[metricName] = metricEnd
      metrics.batch(metricName, metricEnd)
    }, middlewareMetricsKeys)
  }
}
开发者ID:vtex,项目名称:apps-client-node,代码行数:19,代码来源:time.ts


示例9: reduce

export const nativeTypeDefs = (metaData: SchemaMetaData) => reduce(
  (acc, scalar) => !metaData[scalar] ? `${acc}\nscalar ${scalar}\n` : acc,
  '',
  keys(scalarResolversMap)
)
开发者ID:vtex,项目名称:apps-client-node,代码行数:5,代码来源:index.ts


示例10:

export const process = (user: User): User => {
	return Object.assign({ }, user, {
		$tenants: R.keys(user.tenants),
	});
}
开发者ID:simbiosis-group,项目名称:ion2-contact,代码行数:5,代码来源:user.reducer.ts



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
TypeScript ramda.last函数代码示例发布时间:2022-05-25
下一篇:
TypeScript ramda.join函数代码示例发布时间: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