當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。