Grabbed dndbeyond's source code
``` ~/go/bin/sourcemapper -output ddb -jsurl https://media.dndbeyond.com/character-app/static/js/main.90aa78c5.js ```
This commit is contained in:
+29
@@ -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));
|
||||
};
|
||||
};
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
module.exports = function isArrayish(obj) {
|
||||
if (!obj || typeof obj === 'string') {
|
||||
return false;
|
||||
}
|
||||
|
||||
return obj instanceof Array || Array.isArray(obj) ||
|
||||
(obj.length >= 0 && (obj.splice instanceof Function ||
|
||||
(Object.getOwnPropertyDescriptor(obj, (obj.length - 1)) && obj.constructor.name !== 'String')));
|
||||
};
|
||||
Reference in New Issue
Block a user