flow like the river
This commit is contained in:
commit
013fe673f3
42435 changed files with 5764238 additions and 0 deletions
24
BACK_BACK/node_modules/parcel-bundler/lib/utils/serializeObject.js
generated
vendored
Executable file
24
BACK_BACK/node_modules/parcel-bundler/lib/utils/serializeObject.js
generated
vendored
Executable file
|
|
@ -0,0 +1,24 @@
|
|||
"use strict";
|
||||
|
||||
const _require = require('terser'),
|
||||
minify = _require.minify;
|
||||
|
||||
const serialize = require('serialize-to-js');
|
||||
|
||||
function serializeObject(obj, shouldMinify = false) {
|
||||
let code = `module.exports = ${serialize(obj)};`;
|
||||
|
||||
if (shouldMinify) {
|
||||
let minified = minify(code);
|
||||
|
||||
if (minified.error) {
|
||||
throw minified.error;
|
||||
}
|
||||
|
||||
code = minified.code;
|
||||
}
|
||||
|
||||
return code;
|
||||
}
|
||||
|
||||
module.exports = serializeObject;
|
||||
Loading…
Add table
Add a link
Reference in a new issue