UNPKG

@intlayer/core

Version:

Includes core Intlayer functions like translation, dictionary, and utility functions shared across multiple packages.

20 lines (18 loc) 424 B
//#region src/interpreter/getInsertion.ts /** * Allow to insert values in a string. * * Usage: * * ```ts * const content = getInsertion('Hello {{name}}!', { * name: 'John', * }); * // 'Hello John!' * ``` * */ const getInsertion = (content, values) => content.replace(/\{\{(.*?)\}\}/g, (_, key) => (values[key] ?? "").toString()); //#endregion exports.getInsertion = getInsertion; //# sourceMappingURL=getInsertion.cjs.map