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

ab-array

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ab-array - npm Package Compare versions

Comparing version 0.0.3 to 0.0.4

39

index.js

@@ -14,41 +14,2 @@ 'use strict';

Array.prototype.move = function(old_index, new_index) {
if (new_index >= this.length) {
var k = new_index - this.length;
while ((k--) + 1) {
this.push(undefined);
}
}
this.splice(new_index, 0, this.splice(old_index, 1)[0]);
// return this; // for testing purposes
};
Array.prototype.moveUp = function(value, by) {
var index = this.indexOf(value),
newPos = index - (by || 1);
if(index === -1)
throw new Error("Element not found in array");
if(newPos < 0)
newPos = 0;
this.splice(index,1);
this.splice(newPos,0,value);
};
Array.prototype.moveDown = function(value, by) {
var index = this.indexOf(value),
newPos = index + (by || 1);
if(index === -1)
throw new Error("Element not found in array");
if(newPos >= this.length)
newPos = this.length;
this.splice(index, 1);
this.splice(newPos,0,value);
};
if(!Array.prototype.indexOf) {

@@ -55,0 +16,0 @@ Array.prototype.indexOf = function(what, i) {

2

package.json
{
"name": "ab-array",
"version": "0.0.3",
"version": "0.0.4",
"description": "Array prototype addons",

@@ -5,0 +5,0 @@ "main": "index.js",

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