simple-swizzle
Advanced tools
Comparing version
'use strict'; | ||
var isArrayish = require('is-arrayish'); | ||
var concat = Array.prototype.concat; | ||
@@ -12,4 +14,3 @@ var slice = Array.prototype.slice; | ||
// https://jsperf.com/hasownproperty-vs-in-vs-undefined/12 | ||
if (typeof arg.length !== 'undefined') { | ||
if (isArrayish(arg)) { | ||
// http://jsperf.com/javascript-array-concat-vs-push/98 | ||
@@ -16,0 +17,0 @@ results = concat.call(results, slice.call(arg)); |
{ | ||
"name": "simple-swizzle", | ||
"description": "Simply swizzle your arguments", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"author": "Qix (http://github.com/qix-)", | ||
@@ -32,3 +32,6 @@ "keywords": [ | ||
"xo": "^0.7.1" | ||
}, | ||
"dependencies": { | ||
"is-arrayish": "^0.3.0" | ||
} | ||
} |
@@ -27,3 +27,3 @@ # simple-swizzle [](https://travis-ci.org/Qix-/node-simple-swizzle) [](https://coveralls.io/r/Qix-/node-simple-swizzle) | ||
var sfn = swizzle.wrap(function (args) { | ||
var swizzledFn = swizzle.wrap(function (args) { | ||
// ... | ||
@@ -33,6 +33,5 @@ return args; | ||
sfn(1, [2, 3], 4); // [1, 2, 3, 4] | ||
sfn(1, 2, 3, 4); // [1, 2, 3, 4] | ||
sfn([1, 2, 3, 4]); // [1, 2, 3, 4] | ||
swizzledFn(1, [2, 3], 4); // [1, 2, 3, 4] | ||
swizzledFn(1, 2, 3, 4); // [1, 2, 3, 4] | ||
swizzledFn([1, 2, 3, 4]); // [1, 2, 3, 4] | ||
``` | ||
@@ -39,0 +38,0 @@ |
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
3602
1.21%0
-100%1
Infinity%40
-2.44%+ Added
+ Added