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

array-tools

Package Overview
Dependencies
Maintainers
1
Versions
53
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

array-tools - npm Package Compare versions

Comparing version 1.6.1 to 1.6.2

25

lib/array-tools.js
"use strict";
/* in this case setting module.exports above the requires is significant - it avoids circular reference issues */
module.exports = ArrayTools;

@@ -51,10 +53,13 @@

function ArrayTools(array){
if (!(this instanceof ArrayTools)) return new ArrayTools(array);
if (!Array.isArray(array)) throw new Error("must pass an array to array-tools");
this._array = array.slice(0);
function ArrayTools(input){
if (!(this instanceof ArrayTools)) return new ArrayTools(input);
if (Array.isArray(input)){
this._data = input.slice(0);
} else {
this._data = input;
}
}
ArrayTools.prototype.val = function(){
return this._array;
return this._data;
};

@@ -64,3 +69,3 @@

ArrayTools.prototype[method] = function(){
this._array = Array.prototype[method].apply(this._array, arguments);
this._data = Array.prototype[method].apply(this._data, arguments);
return this;

@@ -70,7 +75,7 @@ };

["pluck", "pick", "arrayify", "where", "without", "unique", "spliceWhile", "extract", "flatten", "sortBy"].forEach(function(method){
["pluck", "pick", "arrayify", "where", "findWhere", "without", "unique", "spliceWhile", "extract", "flatten", "sortBy"].forEach(function(method){
ArrayTools.prototype[method] = function(){
var args = arrayify(arguments);
args.unshift(this._array);
this._array = ArrayTools[method].apply(null, args);
args.unshift(this._data);
this._data = ArrayTools[method].apply(null, args);
return this;

@@ -81,3 +86,3 @@ };

ArrayTools.prototype.exists = function(value){
return exists(this._array, value);
return exists(this._data, value);
};

@@ -84,0 +89,0 @@

2

package.json
{
"name": "array-tools",
"author": "Lloyd Brookes <75pound@gmail.com>",
"version": "1.6.1",
"version": "1.6.2",
"description": "Lightweight tool-kit for working with arrays",

@@ -6,0 +6,0 @@ "repository": "https://github.com/75lb/array-tools.git",

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