本文整理汇总了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),