UNPKG

@intlayer/core

Version:

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

28 lines (26 loc) 1.11 kB
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); 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) => deepTransformNode(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