Comparing version 0.0.3 to 0.0.4
@@ -6,3 +6,2 @@ /** | ||
Array.prototype.equals = Array.prototype.compare = function equals(array) { | ||
//http://stackoverflow.com/questions/7837456/comparing-two-arrays-in-javascript | ||
if (typeof array == 'undefined' || !Array.isArray(array)) | ||
@@ -34,3 +33,2 @@ return false; | ||
Array.prototype.toObject = function toObject() { | ||
//http://stackoverflow.com/questions/7837456/comparing-two-arrays-in-javascript | ||
var object = {}; | ||
@@ -46,3 +44,2 @@ for (var i = 0; i < this.length; ++i){ | ||
Array.prototype.shuffle = function shuffle() { | ||
//http://stackoverflow.com/questions/6274339/how-can-i-shuffle-an-array-in-javascript | ||
var counter = this.length, temp, index; | ||
@@ -65,3 +62,2 @@ | ||
Array.prototype.unique = function() { | ||
//http://stackoverflow.com/questions/1584370/how-to-merge-two-arrays-in-javascript | ||
var a = this.concat(); | ||
@@ -84,2 +80,26 @@ | ||
return this; | ||
}; | ||
}; | ||
//index ranges | ||
Array.prototype.range = function(min,max){ | ||
if(!this[min] || !this[max] || min > max) | ||
return this; | ||
var newArray = []; | ||
for(var i=min; i<=max;i++){ | ||
newArray.push(this[i]); | ||
} | ||
return newArray; | ||
}; | ||
Array.prototype.valueRange = function valueRange(min,max){ | ||
if(this.length < 1) | ||
return this; | ||
var newArray = []; | ||
for(var i = 0;i<this.length; i++){ | ||
if(this[i] >= min && this[i] <=max) | ||
newArray.push(this[i]); | ||
} | ||
return newArray; | ||
}; | ||
{ | ||
"name": "array-util", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"description": "Array utils for misc. but useful things, so far just compares arrays", | ||
@@ -5,0 +5,0 @@ "main": "./lib/util", |
@@ -5,1 +5,15 @@ ArrayUtil | ||
Array utils for misc. but useful things | ||
-merge | ||
-equals (Compare) | ||
-shuffle | ||
-toObject | ||
-unique | ||
-range | ||
-valueRange |
Sorry, the diff of this file is not supported yet
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
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
7502
12
168
18
0