1
0
Fork 0
management/front/dkha-web-sz-main/node_modules/svg-sprite-loader/lib/utils/stringify.js

16 lines
354 B
JavaScript
Raw Permalink Normal View History

2023-12-18 13:12:25 +08:00
const stringifiedRegexp = /^'|".*'|"$/;
/**
* If already stringified - return original content
* @param {Object|Array} content
* @return {string}
*/
function stringify(content) {
if (typeof content === 'string' && stringifiedRegexp.test(content)) {
return content;
}
return JSON.stringify(content, null, 2);
}
module.exports = stringify;