本文整理匯總了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();
});
示例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;
});
示例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
}
};
});
示例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);
});
示例5:
export const removeCardHandler = (
state: CardContainer,
payload: Card
): CardContainer => R.assocPath([payload.id, 'zone'], Zone.Graveyard, state);
示例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();
});
示例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)
示例8:
const drawCardHandler = (state: CardContainer, payload: number): CardContainer =>
R.assocPath([payload, 'zone'], Zone.Hand, state);
示例9: buildParameter
(acc, paramConf: swaggerParam) =>
R.assocPath(R.props(['in', 'name'], paramConf), buildParameter(joi, paramConf), acc),