UNPKG

pixi.js

Version:

<p align="center"> <a href="https://pixijs.com" target="_blank" rel="noopener noreferrer"> <img height="150" src="https://files.pixijs.download/branding/pixijs-logo-transparent-dark.svg?v=1" alt="PixiJS logo"> </a> </p> <br/> <p align="center">

32 lines (30 loc) 831 B
"use strict"; function processX(base, ids, depth, result, tags) { const id = ids[depth]; for (let i = 0; i < id.length; i++) { const value = id[i]; if (depth < ids.length - 1) { processX(base.replace(result[depth], value), ids, depth + 1, result, tags); } else { tags.push(base.replace(result[depth], value)); } } } function createStringVariations(string) { const regex = /\{(.*?)\}/g; const result = string.match(regex); const tags = []; if (result) { const ids = []; result.forEach((vars) => { const split = vars.substring(1, vars.length - 1).split(","); ids.push(split); }); processX(string, ids, 0, result, tags); } else { tags.push(string); } return tags; } export { createStringVariations }; //# sourceMappingURL=createStringVariations.mjs.map