Comparing version 1.2.2 to 1.2.3
{ | ||
"name": "proto-list", | ||
"version": "1.2.2", | ||
"version": "1.2.3", | ||
"description": "A utility for managing a prototype chain", | ||
@@ -5,0 +5,0 @@ "main": "./proto-list.js", |
module.exports = ProtoList | ||
function setProto(obj, proto) { | ||
if (typeof Object.setPrototypeOf === "function") | ||
return Object.setPrototypeOf(obj, proto) | ||
else | ||
obj.__proto__ = proto | ||
} | ||
function ProtoList () { | ||
@@ -12,3 +19,3 @@ this.list = [] | ||
if (this.list.length) { | ||
this.list[this.list.length - 1].__proto__ = r | ||
setProto(this.list[this.list.length - 1], r) | ||
} | ||
@@ -39,5 +46,5 @@ }, | ||
if (this.list.length >= 1) { | ||
this.list[this.list.length - 1].__proto__ = obj | ||
setProto(this.list[this.list.length - 1], obj) | ||
} | ||
obj.__proto__ = this.root | ||
setProto(obj, this.root) | ||
return this.list.push(obj) | ||
@@ -47,3 +54,3 @@ } | ||
if (this.list.length >= 2) { | ||
this.list[this.list.length - 2].__proto__ = this.root | ||
setProto(this.list[this.list.length - 2], this.root) | ||
} | ||
@@ -53,3 +60,3 @@ return this.list.pop() | ||
, unshift : function (obj) { | ||
obj.__proto__ = this.list[0] || this.root | ||
setProto(obj, this.list[0] || this.root) | ||
return this.list.unshift(obj) | ||
@@ -59,3 +66,3 @@ } | ||
if (this.list.length === 1) { | ||
this.list[0].__proto__ = this.root | ||
setProto(this.list[0], this.root) | ||
} | ||
@@ -82,3 +89,3 @@ return this.list.shift() | ||
for (var i = 0, l = this.list.length; i < l; i++) { | ||
this.list[i].__proto__ = this.list[i + 1] || this.root | ||
setProto(this.list[i], this.list[i + 1] || this.root) | ||
} | ||
@@ -85,0 +92,0 @@ return ret |
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
Non-existent author
Supply chain riskThe package was published by an npm account that no longer exists.
Found 1 instance in 1 package
5272
134
0