UNPKG

@intlayer/core

Version:

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

1 lines 1.04 kB
{"version":3,"file":"gender.mjs","names":[],"sources":["../../../../src/transpiler/gender/gender.ts"],"sourcesContent":["import { formatNodeType, NodeType, type TypedNodeModel } from '@intlayer/types';\n\nexport type Gender = 'male' | 'female' | 'fallback';\n\nexport type GenderContentStates<Content> = Record<`${Gender}`, Content> & {\n fallback?: Content;\n};\n\nexport type GenderContent<Content = unknown> = TypedNodeModel<\n NodeType.Gender,\n GenderContentStates<Content>\n>;\n\n/**\n * Function intended to be used to build intlayer dictionaries.\n *\n * Allow to pick a content based on a gender.\n *\n * Usage:\n *\n * ```ts\n * gender({\n * 'true': 'The gender is validated',\n * 'false': 'The gender is not validated',\n * });\n * ```\n *\n * The last key provided will be used as the fallback value.\n *\n */\nconst gender = <Content>(content?: GenderContentStates<Content>) =>\n formatNodeType(NodeType.Gender, content);\n\nexport { gender };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA8BA,MAAM,UAAmB,YACvB,eAAe,SAAS,QAAQ,QAAQ"}