UNPKG

@yokgs/dyescript-light

Version:

Command Line Interface of lightweight (& pre-published) version of @yokgs/DyeScript

7 lines 285 B
module.exports = function (input, store) { let matchedVariables = [...new Set([...input.match(/&[a-z]{1}[\w\-]*/gi) || []])]; for (let variable of matchedVariables) { input = input.replaceAll(variable, store.get(variable.slice(1)) || 0); } return input; }