MCPcopy Create free account
hub / github.com/6pac/SlickGrid / stripBom

Function stripBom

scripts/fs-utils.mjs:46–52  ·  view source on GitHub ↗
(content)

Source from the content-addressed store, hash-verified

44}
45
46export function stripBom(content) {
47 // we do this because JSON.parse would convert it to a utf8 string if encoding wasn't specified
48 if (Buffer.isBuffer(content)) {
49 content = content.toString('utf8');
50 }
51 return content.replace(/^\uFEFF/, '');
52}
53
54export function writeJsonSync(file, obj, options = {}) {
55 const str = stringify(obj, options);

Callers 1

readJSONSyncFunction · 0.85

Calls 1

toStringMethod · 0.80

Tested by

no test coverage detected