1 | var _ = require('lodash');
|
2 |
|
3 | module.exports = function (code, options) {
|
4 | if (!options.replaceUnicode) {
|
5 | return code;
|
6 | }
|
7 |
|
8 | return code.replace(/[^\u0000-\u007f]/g, function (match) {
|
9 | return '\\u' + _.padStart(match.charCodeAt(0).toString(16), 4, '0');
|
10 | });
|
11 | };
|