UNPKG

@intlayer/core

Version:

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

27 lines (25 loc) 1.04 kB
const require_interpreter_getContent_deepTransform = require('../interpreter/getContent/deepTransform.cjs'); //#region src/deepTransformPlugins/getMaskContent.ts const passTypedNodePlugin = { id: "pass-typed-node-plugin", canHandle: (node) => typeof node === "object" && typeof node?.nodeType === "string", transform: (node, props, deepTransformNode$1) => deepTransformNode$1(node[node.nodeType], props) }; /** Translation plugin. Replaces node with a locale string if nodeType = Translation. */ const buildMaskPlugin = { id: "build-mask-plugin", canHandle: (node) => typeof node === "string" || typeof node === "number", transform: () => true }; const getMaskContent = (source) => ({ ...source, content: require_interpreter_getContent_deepTransform.deepTransformNode(source.content, { dictionaryKey: source.key, keyPath: [], plugins: [passTypedNodePlugin, buildMaskPlugin] }) }); //#endregion exports.buildMaskPlugin = buildMaskPlugin; exports.getMaskContent = getMaskContent; //# sourceMappingURL=getMaskContent.cjs.map