{"version":3,"sources":["jsdelivr-header.js","/npm/replace-temp-values@0.1.5/index.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,ACNA,IAAI,GAAK,QAAQ,MASjB,OAAO,QAAU,SAAS,EAAM,EAAM,EAAQ,GAG5C,IACI,EADA,EAAS,IAIb,GAAG,SAAS,GAAM,SAAS,EAAK,GAE9B,GAAG,EAAO,OAAO,EAEjB,IAAI,EAAW,EAAK,WAGpB,IAAI,IAAI,KAAO,EAGb,GAAG,EAAO,eAAe,GACzB,CAME,GAJA,EAAQ,IAAI,OAAO,EAAS,EAAM,EAAQ,OAE3B,EAAS,QAAQ,EAAS,EAAM,IAEhC,GASb,OAAO,QAAQ,MAAM,kBAAoB,EAAM,iBAN/C,EAAW,EAAS,QAAQ,EAAO,EAAO,GAU9C,CAIF,GAAG,UAAU,EAAM,GAAU,SAAS,GAGpC,GAAG,EAAO,MAAM,EAEhB,OAAO,GAAW,EAAS,EAE7B,GAEF,GAEF","file":"/npm/replace-temp-values@0.1.5/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/replace-temp-values@0.1.5/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","var fs = require('fs');\n\n/**\n * @name Replace Temp Values\n * @param file the path the file\n * @param dest where to send the file\n * @param values object with the variable to be replaced and its replacement\n * @param callback\n */\nmodule.exports = function(file, dest, values, callback)\n{\n\n  var marker = '%',\n      regex;\n\n  //Read file\n  fs.readFile(file, function(err, data)\n  {\n    if(err) { return err; }\n\n    var replaced = data.toString();\n\n\n    for(var key in values)\n    {\n\n      if(values.hasOwnProperty(key))\n      {\n\n        regex = new RegExp(marker + key + marker, 'g');\n\n        var contains = replaced.indexOf(marker + key + marker);\n\n        if(contains > -1)\n        {\n\n          replaced = replaced.replace(regex, values[key]);\n\n        }\n        else\n        {\n\n          return console.error('Template Value ' + key + ' is not found');\n\n        }\n\n      }\n\n    }\n\n    fs.writeFile(dest, replaced, function(err)\n    {\n\n      if(err) { throw err; }\n\n      return callback ? callback(replaced) : true;\n\n    });\n\n  });\n\n};"]}