Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
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"]}