install npm

This commit is contained in:
2019-01-29 19:33:51 +01:00
parent b9a54b97a7
commit 5eedee288e
8785 changed files with 817030 additions and 0 deletions
+24
View File
@@ -0,0 +1,24 @@
'use strict';
var isUtf8 = require('is-utf8');
var stripBom = module.exports = function (arg) {
if (typeof arg === 'string') {
return arg.replace(/^\ufeff/g, '');
}
if (Buffer.isBuffer(arg) && isUtf8(arg) &&
arg[0] === 0xef && arg[1] === 0xbb && arg[2] === 0xbf) {
return arg.slice(3);
}
return arg;
};
stripBom.stream = function () {
var firstChunk = require('first-chunk-stream');
return firstChunk({minSize: 3}, function (chunk, enc, cb) {
this.push(stripBom(chunk));
cb();
});
};