Socket
Socket
Sign inDemoInstall

npm-normalize-package-bin

Package Overview
Dependencies
0
Maintainers
9
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.0 to 1.0.1

2

index.js

@@ -13,2 +13,4 @@ // pass in a manifest with a 'bin' field here, and it'll turn it

const normalizeString = pkg => {
if (!pkg.name)
return removeBin(pkg)
pkg.bin = { [pkg.name]: pkg.bin }

@@ -15,0 +17,0 @@ return normalizeObject(pkg)

2

package.json
{
"name": "npm-normalize-package-bin",
"version": "1.0.0",
"version": "1.0.1",
"description": "Turn any flavor of allowable package.json bin into a normalized object",

@@ -5,0 +5,0 @@ "repository": "git+https://github.com/npm/npm-normalize-package-bin",

@@ -31,2 +31,3 @@ const normalize = require('../')

array: [1,2,3],
func: function () {},
} }

@@ -45,2 +46,3 @@ const expect = { name: 'hello', version: 'world', bin: {

'/etc/glorb/baz': '/etc/passwd',
'/etc/passwd:/bin/usr/exec': '/etc/passwd',
} }

@@ -54,2 +56,3 @@ const expect = {

baz: 'etc/passwd',
exec: 'etc/passwd',
}

@@ -56,0 +59,0 @@ }

@@ -24,1 +24,15 @@ const normalize = require('../')

})
t.test('double path', async t => {
const pkg = { name: 'hello', version: 'world', bin: '/etc/passwd:/bin/usr/exec' }
const expect = { name: 'hello', version: 'world', bin: { hello: 'etc/passwd:/bin/usr/exec' } }
t.strictSame(normalize(pkg), expect)
t.strictSame(normalize(normalize(pkg)), expect, 'double sanitize ok')
})
t.test('string with no name', async t => {
const pkg = { bin: 'foobar.js' }
const expect = {}
t.strictSame(normalize(pkg), expect)
t.strictSame(normalize(normalize(pkg)), expect, 'double sanitize ok')
})

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc