You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 7-8.RSVP
Socket
Socket
Sign inDemoInstall

strip-bom

Package Overview
Dependencies
1
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.0 to 0.2.0

9

index.js
'use strict';
var isUtf8 = require('is-utf8');
module.exports = function (arg) {

@@ -7,7 +9,8 @@ if (typeof arg === 'string') {

if (Buffer.isBuffer(arg)) {
return arg[0] === 0xEF && arg[1] === 0xBB && arg[2] === 0xBF ? arg.slice(3) : arg;
if (Buffer.isBuffer(arg) && isUtf8(arg) &&
arg[0] === 0xEF && arg[1] === 0xBB && arg[2] === 0xBF) {
return arg.slice(3);
}
throw new TypeError('Expected a string or buffer');
return arg;
};
{
"name": "strip-bom",
"version": "0.1.0",
"version": "0.2.0",
"description": "Strip UTF-8 byte order mark (BOM) from a string/buffer",

@@ -42,2 +42,5 @@ "license": "MIT",

],
"dependencies": {
"is-utf8": "^0.2.0"
},
"devDependencies": {

@@ -44,0 +47,0 @@ "mocha": "*"

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc