UNPKG

@newbiz/admin-script-libs

Version:

신사업 프론트엔드 공통 어드민 셋업 라이브러리.

16 lines (11 loc) 483 B
function stringify (obj, options = {}) { const EOL = options.EOL || '\n' const str = JSON.stringify(obj, options ? options.replacer : null, options.spaces) return str.replace(/\n/g, EOL) + EOL } function stripBom (content) { // we do this because JSON.parse would convert it to a utf8 string if encoding wasn't specified if (Buffer.isBuffer(content)) content = content.toString('utf8') return content.replace(/^\uFEFF/, '') } module.exports = { stringify, stripBom }