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

array-swap

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

array-swap - npm Package Compare versions

Comparing version 0.0.3 to 0.0.4

13

index.js
if (!Array.prototype.swap) {
/**
* Swap array elements position
*
* @param {number} x - index position
* @param {number} y - index position
*
* return {object} this
*/
var swap = function(x, y) {
this[x] = this.splice(y, 1, this[x])[0];

@@ -9,2 +16,3 @@ return this;

// Extending Array.prototype
if (Object.defineProperty) {

@@ -18,5 +26,6 @@ try {

});
} catch(e) {}
} catch(e) {}
}
// assign swap
Array.prototype.swap = swap;

@@ -23,0 +32,0 @@

2

package.json
{
"name": "array-swap",
"version": "0.0.3",
"version": "0.0.4",
"description": "Swapping two items in a javascript array - Array.prototype.swap",

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