All Downloads are FREE. Search and download functionalities are using the official Maven repository.

package.dist.util.formatMessage.js.map Maven / Gradle / Ivy

{"version":3,"file":"formatMessage.js","sourceRoot":"","sources":["../../src/util/formatMessage.ts"],"names":[],"mappings":"AAAA,MAAM,kBAAkB,GAAG,oEAAoE,CAAC;AAEhG,MAAM,aAAa,GAAG,CAAC,IAAY,EAAE,MAA8B,EAAE,EAAE;IACtE,MAAM,GAAG,MAAM,IAAI,EAAE,CAAC;IAEtB,OAAO,IAAI,CAAC,OAAO,CAAC,kBAAkB,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAmB,EAAE,MAAc,EAAE,EAAE;QAC3F,IAAI,EAAE,EAAE;YACP,OAAO,IAAI,CAAC,CAAC,yBAAyB;SACtC;QAED,IAAI,EAAE,EAAE;YACP,OAAO,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,yBAAyB;SACzD;QAED,IAAI,EAAE,EAAE;YACP,MAAM,GAAG,GAAG,OAAO,EAAE,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YACvD,OAAO,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;SAC3B;QAED,MAAM,IAAI,KAAK,CAAC,uCAAuC,MAAM,EAAE,CAAC,CAAC;IAClE,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,aAAa,CAAC","sourcesContent":["const messageFormatRegEX = /('')|'([^']+(?:''[^']*)*)(?:'|$)|\\{([0-9]+(?:\\s*,[^{}]*)?)\\}|[{}]/g;\n\nconst formatMessage = (text: string, values: Array) => {\n\tvalues = values || [];\n\n\treturn text.replace(messageFormatRegEX, ($0, $1, $2, $3: string | number, offset: number) => {\n\t\tif ($1) {\n\t\t\treturn '\\''; /* eslint-disable-line */\n\t\t}\n\n\t\tif ($2) {\n\t\t\treturn $2.replace(/''/g, '\\''); /* eslint-disable-line */\n\t\t}\n\n\t\tif ($3) {\n\t\t\tconst ind = typeof $3 === \"string\" ? parseInt($3) : $3;\n\t\t\treturn String(values[ind]);\n\t\t}\n\n\t\tthrow new Error(`[i18n]: pattern syntax error at pos ${offset}`);\n\t});\n};\n\nexport default formatMessage;\n"]}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy