{"version":3,"file":"enumeration.mjs","names":[],"sources":["../../../../src/transpiler/enumeration/enumeration.ts"],"sourcesContent":["import type { TypedNodeModel } from '@intlayer/types/nodeType';\nimport { ENUMERATION, formatNodeType } from '@intlayer/types/nodeType';\n\ntype Positive = number | `${number}`;\ntype Negative = `-${number}`;\ntype Numbers = Positive | Negative;\n\ntype Equal = Numbers;\ntype EqualString = `=${Numbers}`;\ntype Superior = `>${Numbers}`;\ntype SuperiorOrEqual = `>=${Numbers}`;\ntype Inferior = `<${Numbers}`;\ntype InferiorOrEqual = `<=${Numbers}`;\n\nexport type EnterFormat =\n  | Equal\n  | EqualString\n  | Superior\n  | SuperiorOrEqual\n  | Inferior\n  | InferiorOrEqual;\n\nexport type EnumerationContentState<Content> = Partial<\n  Record<EnterFormat, Content>\n> & {\n  fallback?: Content;\n};\n\nexport type EnumerationContent<Content = unknown> = TypedNodeModel<\n  typeof ENUMERATION,\n  EnumerationContentState<Content>\n>;\n\n/**\n * Function intended to be used to build intlayer dictionaries.\n *\n * Allow to pick a content based on a quantity.\n *\n * Usage:\n *\n * ```ts\n * enu({\n *  '<=-2.3': 'You have less than -2.3',\n *  '<1': 'You have less than one',\n *  '2': 'You have two',\n *  '>=3': 'You have three or more',\n * });\n * ```\n *\n * > The order of the keys will define the priority of the content.\n *\n */\nconst enumeration = <Content = unknown>(\n  content?: EnumerationContentState<Content>\n): EnumerationContent<Content> => formatNodeType(ENUMERATION, content);\n\nexport { enumeration as enu };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAoDA,MAAM,eACJ,YACgC,eAAe,aAAa,QAAQ"}