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


TypeScript ramda.assocPath函数代码示例

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


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

示例1: it

 it('should return false on entity updates (after initial load)', () => {
   let _resources = assocPath(
     ['linodes'],
     { loading: true, lastUpdated: 1 },
     resources
   );
   expect(entitiesLoading(_resources as any)).toBeFalsy();
   _resources = assocPath(
     ['linodes'],
     { loading: true, lastUpdated: new Date() },
     resources
   );
   expect(entitiesLoading(_resources as any)).toBeFalsy();
 });
开发者ID:linode,项目名称:manager,代码行数:14,代码来源:entitiesLoading.test.ts

示例2: getImageConfig

wrap<BuildConfig>(function* (
  config: BuildConfig,
  opts: BuildOptions,
  name: string,
  buildDir: string,
  configDir: string
  ): IterableIterator<Promise<any>> {

  const imageName = config.prefix ? `${config.prefix}${name}` : name;
  console.log(`\n\n--> building ${imageName}\n`);

  const imageConfig = getImageConfig(config, name);
  const {version, dockerfile, isTemplate} = imageConfig;
  const newVersion = version + 1;
  const imageTag = `${imageName}:v${newVersion}`;

  let dockerfilePath: string;

  if (isTemplate) {
    dockerfilePath = yield renderDockerfile(imageConfig, config, buildDir, configDir);
  } else {
    dockerfilePath = resolve(configDir, dockerfile);
  }

  yield buildImage(dockerfilePath, imageTag, config, opts);

  let updatedConfig = assocPath(['images', name, 'version'], newVersion, config);

  const childImageNames = findChildImages(name, updatedConfig.images);
  for (const childImageName of childImageNames) {
    updatedConfig = yield build(updatedConfig, opts, childImageName, buildDir, configDir);
  }

  return updatedConfig;
});
开发者ID:d6u,项目名称:docker-build-layers,代码行数:35,代码来源:build.ts

示例3: setStackScript

 setStackScript((prevState: any) => {
   // either overwrite or create new selection
   const newUDFData = assocPath([key], value, prevState.udf_data);
   return {
     ...prevState,
     udf_data: {
       ...prevState.udf_data,
       ...newUDFData
     }
   };
 });
开发者ID:linode,项目名称:manager,代码行数:11,代码来源:useStackScript.ts

示例4: it

 it("should recompute if an entry in entities is updated", () => {
   getSearchEntities.resetRecomputations();
   const updatedLinodes = assocPath([0, 'label'], 'newlabel', linodes);
   getSearchEntities({ ...mockState, linodes: { entities: updatedLinodes } });
   expect(getSearchEntities.recomputations()).toEqual(1);
 });
开发者ID:displague,项目名称:manager,代码行数:6,代码来源:getSearchEntitites.test.ts

示例5:

export const removeCardHandler = (
  state: CardContainer,
  payload: Card
): CardContainer => R.assocPath([payload.id, 'zone'], Zone.Graveyard, state);
开发者ID:zernie,项目名称:typescript-redux-card-game,代码行数:4,代码来源:handReducer.ts

示例6: it

 it("should return true if any entity type is still loading", () => {
   const _resources = assocPath(['linodes', 'loading'], true, resources);
   expect(entitiesLoading(_resources as any)).toBeTruthy();
 });
开发者ID:displague,项目名称:manager,代码行数:4,代码来源:entitiesLoading.test.ts

示例7: pick

    return R.path(defaultVal, fieldsLevelArr, obj)
  },
  // pick :: [k] → {k: v} → {k: v}
  pick(fieldsArr, obj) {
    return R.pick(fieldsArr, obj)
  },

  // assoc/assocPath
  // assoc :: String → a → {k: v} → {k: v}
  assoc(field, val, obj) {
    return R.assoc(field, val, obj)
  },
  // [Idx] → a → {a} → {a}
  // Idx = String | Int
  assocPath(fieldsLevelArr, val, obj) {
    return R.assocPath(fieldsLevelArr, val, obj)
  },

  // dissoc/dissocPath
  // String → {k: v} → {k: v}
  dissoc(field, val, obj) {
    return R.dissoc(field, val, obj)
  },
  // [Idx] → {k: v} → {k: v}
  // Idx = String | Int
  dissocPath(fieldsLevelArr, obj) {
    return R.dissocPath(fieldsLevelArr, obj)
  },
  // omit :: [String] → {String: *} → {String: *}
  omit(fieldsArr, obj) {
    return R.omit(fieldsArr, obj)
开发者ID:stefaniepei,项目名称:react-redux-scaffold,代码行数:31,代码来源:ramda.ts

示例8:

const drawCardHandler = (state: CardContainer, payload: number): CardContainer =>
  R.assocPath([payload, 'zone'], Zone.Hand, state);
开发者ID:zernie,项目名称:typescript-redux-card-game,代码行数:2,代码来源:deckReducer.ts

示例9: buildParameter

 (acc, paramConf: swaggerParam) =>
     R.assocPath(R.props(['in', 'name'], paramConf), buildParameter(joi, paramConf), acc),
开发者ID:benjambles,项目名称:my-own-world,代码行数:2,代码来源:build-joi-spec.ts


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