{"version":3,"file":"getInsertion.mjs","names":[],"sources":["../../../src/interpreter/getInsertion.ts"],"sourcesContent":["import type { InsertionContent } from '../transpiler';\n\n/**\n * Allow to insert values in a string.\n *\n * Usage:\n *\n * ```ts\n * const content = getInsertion('Hello {{name}}!', {\n *  name: 'John',\n * });\n * // 'Hello John!'\n * ```\n *\n */\nexport const getInsertion = (\n  content: string,\n  values: { [K in InsertionContent['fields'][number]]: string | number }\n) =>\n  content.replace(/\\{\\{\\s*(.*?)\\s*\\}\\}/g, (_, key) => {\n    const trimmedKey = key.trim();\n    return (values[trimmedKey] ?? '').toString();\n  });\n"],"mappings":";;;;;;;;;;;;;;AAeA,MAAa,gBACX,SACA,WAEA,QAAQ,QAAQ,yBAAyB,GAAG,QAAQ;AAElD,SAAQ,OADW,IAAI,MACE,KAAK,IAAI,UAAU;EAC5C"}