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 @@ |
{ | ||
"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", |
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
1179
27