From e06ec920f7a5d784e674c4c4b4e6d1da3dc7391d Mon Sep 17 00:00:00 2001 From: Piotr Russ Date: Mon, 16 Nov 2020 00:10:28 +0100 Subject: api, login, auth --- node_modules/strip-bom/index.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 node_modules/strip-bom/index.js (limited to 'node_modules/strip-bom/index.js') diff --git a/node_modules/strip-bom/index.js b/node_modules/strip-bom/index.js new file mode 100644 index 0000000..b00feb9 --- /dev/null +++ b/node_modules/strip-bom/index.js @@ -0,0 +1,14 @@ +'use strict'; +module.exports = x => { + if (typeof x !== 'string') { + throw new TypeError('Expected a string, got ' + typeof x); + } + + // Catches EFBBBF (UTF-8 BOM) because the buffer-to-string + // conversion translates it to FEFF (UTF-16 BOM) + if (x.charCodeAt(0) === 0xFEFF) { + return x.slice(1); + } + + return x; +}; -- cgit v1.2.3