当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript ramda.keys函数代码示例

本文整理汇总了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;未经允许,请勿转载。