flow like the river
This commit is contained in:
commit
013fe673f3
42435 changed files with 5764238 additions and 0 deletions
29
BACK_BACK/node_modules/simple-swizzle/index.js
generated
vendored
Executable file
29
BACK_BACK/node_modules/simple-swizzle/index.js
generated
vendored
Executable file
|
|
@ -0,0 +1,29 @@
|
|||
'use strict';
|
||||
|
||||
var isArrayish = require('is-arrayish');
|
||||
|
||||
var concat = Array.prototype.concat;
|
||||
var slice = Array.prototype.slice;
|
||||
|
||||
var swizzle = module.exports = function swizzle(args) {
|
||||
var results = [];
|
||||
|
||||
for (var i = 0, len = args.length; i < len; i++) {
|
||||
var arg = args[i];
|
||||
|
||||
if (isArrayish(arg)) {
|
||||
// http://jsperf.com/javascript-array-concat-vs-push/98
|
||||
results = concat.call(results, slice.call(arg));
|
||||
} else {
|
||||
results.push(arg);
|
||||
}
|
||||
}
|
||||
|
||||
return results;
|
||||
};
|
||||
|
||||
swizzle.wrap = function (fn) {
|
||||
return function () {
|
||||
return fn(swizzle(arguments));
|
||||
};
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue