Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

array-util

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

array-util - npm Package Compare versions

Comparing version 0.0.3 to 0.0.4

test/range.js

30

lib/util.js

@@ -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;
};

2

package.json
{
"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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc