MCPcopy Create free account
hub / github.com/Keyang/node-csvtojson / stripBom

Function stripBom

v1/core/Converter.js:579–591  ·  view source on GitHub ↗
(string)

Source from the content-addressed store, hash-verified

577};
578
579function stripBom(string) {
580 if (typeof string !== 'string') {
581 throw new TypeError(`Expected a string, got ${typeof string}`);
582 }
583
584 // Catches EFBBBF (UTF-8 BOM) because the buffer-to-string
585 // conversion translates it to FEFF (UTF-16 BOM).
586 if (string.charCodeAt(0) === 0xFEFF) {
587 return string.slice(1);
588 }
589
590 return string;
591}
592
593
594module.exports = Converter;

Callers 1

Converter.jsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected