Socket
Socket
Sign inDemoInstall

proto-list

Package Overview
Dependencies
0
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.0 to 1.1.0

test/basic.js

30

package.json

@@ -1,9 +0,21 @@

{ "name" : "proto-list"
, "version" : "1.0.0"
, "description" : "A utility for managing a prototype chain"
, "main" : "./proto-list.js"
, "author" : "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)"
, "scripts" : { "test" : "node proto-list.js" }
, "repository": { "type": "git", "url": "https://github.com/isaacs/proto-list" }
, "license": { "type": "MIT", "url": "https://github.com/isaacs/proto-list/blob/master/LICENSE" }
, "devDependencies" : { "tap" : "0" } }
{
"name": "proto-list",
"version": "1.1.0",
"description": "A utility for managing a prototype chain",
"main": "./proto-list.js",
"author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)",
"scripts": {
"test": "tap test/*.js"
},
"repository": {
"type": "git",
"url": "https://github.com/isaacs/proto-list"
},
"license": {
"type": "MIT",
"url": "https://github.com/isaacs/proto-list/blob/master/LICENSE"
},
"devDependencies": {
"tap": "0"
}
}

@@ -22,3 +22,3 @@

}
obj.__proto__ = Object.prototype
obj.__proto__ = null
return this.list.push(obj)

@@ -28,3 +28,3 @@ }

if (this.list.length >= 2) {
this.list[this.list.length - 2].__proto__ = Object.prototype
this.list[this.list.length - 2].__proto__ = null
}

@@ -34,3 +34,3 @@ return this.list.pop()

, unshift : function (obj) {
obj.__proto__ = this.list[0] || Object.prototype
obj.__proto__ = this.list[0] || null
return this.list.unshift(obj)

@@ -40,3 +40,3 @@ }

if (this.list.length >= 1) {
this.list[0].__proto__ = Object.prototype
this.list[0].__proto__ = null
}

@@ -60,40 +60,9 @@ return this.list.shift()

, splice : function () {
return this.list.splice.apply(this.list, arguments)
// handle injections
var ret = this.list.splice.apply(this.list, arguments)
for (var i = 0, l = this.list.length; i < l; i++) {
this.list[i].__proto__ = this.list[i + 1] || null
}
return ret
}
}
if (module === require.main) {
var tap = require("tap")
, test = tap.test
tap.plan(1)
tap.test("protoList tests", function (t) {
var p = new ProtoList
p.push({foo:"bar"})
p.push({})
p.set("foo", "baz")
t.equal(p.get("foo"), "baz")
var p = new ProtoList
p.push({foo:"bar"})
p.set("foo", "baz")
t.equal(p.get("foo"), "baz")
t.equal(p.length, 1)
p.pop()
t.equal(p.length, 0)
p.set("foo", "asdf")
t.equal(p.length, 1)
t.equal(p.get("foo"), "asdf")
p.push({bar:"baz"})
t.equal(p.length, 2)
t.equal(p.get("foo"), "asdf")
p.shift()
t.equal(p.length, 1)
t.equal(p.get("foo"), undefined)
t.end()
})
}
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