mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-09-29 05:34:21 +08:00
This CL updates minimist to 1.2.6 to fix a critical security vulnerability: https://nvd.nist.gov/vuln/detail/CVE-2021-44906 The fix was made by running: `npm run install-deps audit fix --audit-level=critical` Bug: none Change-Id: I51103b525d9969e03000d55af86cebdabc7e0366 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3591079 Reviewed-by: Mathias Bynens <mathias@chromium.org> Commit-Queue: Brandon Walderman <brwalder@microsoft.com>
15 lines
498 B
JavaScript
15 lines
498 B
JavaScript
function stringify (obj, { EOL = '\n', finalEOL = true, replacer = null, spaces } = {}) {
|
|
const EOF = finalEOL ? EOL : ''
|
|
const str = JSON.stringify(obj, replacer, spaces)
|
|
|
|
return str.replace(/\n/g, EOL) + EOF
|
|
}
|
|
|
|
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 }
|