Skip to content
This repository has been archived by the owner on Aug 20, 2018. It is now read-only.

Commit

Permalink
fix: escape newline/paragraph separators (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
ajhyndman authored and joshwiens committed Jul 22, 2017
1 parent dbf1fa5 commit 939a8cb
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ module.exports = function(source) {
var value = typeof source === "string" ? JSON.parse(source) : source;
var options = loaderUtils.getOptions(this) || {};
value = JSON.stringify(value)
.replace(/\u2028/g, '\\u2028')
.replace(/\u2029/g, '\\u2029');
value = options.stringify ? `'${value}'` : value
var module = this.version && this.version >= 2 ? `export default ${value};` : `module.exports = ${value};`;
return module
Expand Down

0 comments on commit 939a8cb

Please sign in to comment.