proto-list
Advanced tools
Comparing version 1.0.0 to 1.1.0
@@ -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() | ||
}) | ||
} |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Non-existent author
Supply chain riskThe package was published by an npm account that no longer exists.
Found 1 instance in 1 package
4434
5
99
0
1