index.js 295 B

1234567891011
  1. module.exports = function (source) {
  2. if (this.cacheable) this.cacheable();
  3. var value = typeof source === "string" ? JSON.parse(source) : source;
  4. value = JSON.stringify(value)
  5. .replace(/\u2028/g, '\\u2028')
  6. .replace(/\u2029/g, '\\u2029');
  7. return `module.exports = ${value}`;
  8. }