strip-bom-buffer
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -11,5 +11,8 @@ /*! | ||
var isBuffer = require('is-buffer'); | ||
var isUtf8 = require('is-utf8'); | ||
module.exports = function (buffer) { | ||
if (!isBuffer(buffer)) return buffer; | ||
if (!isBuffer(buffer) || !isUtf8(buffer)) { | ||
return buffer; | ||
} | ||
if (String(buffer.slice(0, 3)) === '\ufeff') { | ||
@@ -16,0 +19,0 @@ return buffer.slice(3); |
{ | ||
"name": "strip-bom-buffer", | ||
"description": "Strip a byte order mark (BOM) from a buffer.", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"homepage": "https://github.com/jonschlinkert/strip-bom-buffer", | ||
@@ -23,3 +23,4 @@ "author": "Jon Schlinkert (https://github.com/jonschlinkert)", | ||
"dependencies": { | ||
"is-buffer": "^1.1.0" | ||
"is-buffer": "^1.1.0", | ||
"is-utf8": "^0.2.0" | ||
}, | ||
@@ -42,3 +43,4 @@ "devDependencies": { | ||
"cr", | ||
"copy", | ||
"has-bom", | ||
"read-file", | ||
"strip-bom-string" | ||
@@ -45,0 +47,0 @@ ] |
@@ -1,2 +0,2 @@ | ||
# strip-bom-buffer [![NPM version](https://badge.fury.io/js/strip-bom-buffer.svg)](http://badge.fury.io/js/strip-bom-buffer) | ||
# strip-bom-buffer [![NPM version](https://badge.fury.io/js/strip-bom-buffer.svg)](http://badge.fury.io/js/strip-bom-buffer) [![Build Status](https://travis-ci.org/jonschlinkert/strip-bom-buffer.svg)](https://travis-ci.org/jonschlinkert/strip-bom-buffer) | ||
@@ -17,2 +17,3 @@ > Strip a byte order mark (BOM) from a buffer. | ||
var strip = require('strip-bom-buffer'); | ||
strip(new Buffer('\ufefffoo')); | ||
``` | ||
@@ -22,4 +23,5 @@ | ||
* [copy](https://www.npmjs.com/package/copy): Copy files or directories using globs. | [homepage](https://github.com/jonschlinkert/copy) | ||
* [cr](https://www.npmjs.com/package/cr): Strip windows carriage returns, or convert carriage returns to newlines. | [homepage](https://github.com/jonschlinkert/cr) | ||
* [has-bom](https://www.npmjs.com/package/has-bom): Returns true if a buffer or string has a byte order mark (BOM) | [homepage](https://github.com/jonschlinkert/has-bom) | ||
* [read-file](https://www.npmjs.com/package/read-file): Thin wrapper around fs.readFile and fs.readFileSync that also strips byte order marks when `utf8` encoding… [more](https://www.npmjs.com/package/read-file) | [homepage](https://github.com/jonschlinkert/read-file) | ||
* [strip-bom-string](https://www.npmjs.com/package/strip-bom-string): Strip a byte order mark (BOM) from a string. | [homepage](https://github.com/jonschlinkert/strip-bom-string) | ||
@@ -26,0 +28,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4361
18
53
2
+ Addedis-utf8@^0.2.0
+ Addedis-utf8@0.2.1(transitive)