123456789101112131415161718192021222324252627282930313233 |
- /**
- * An Array.prototype.slice.call(arguments) alternative
- *
- * @param {Object} args something with a length
- * @param {Number} slice
- * @param {Number} sliceEnd
- * @api public
- */
- module.exports = function (args, slice, sliceEnd) {
- var ret = [];
- var len = args.length;
- if (0 === len) return ret;
- var start = slice < 0
- ? Math.max(0, slice + len)
- : slice || 0;
- if (sliceEnd !== undefined) {
- len = sliceEnd < 0
- ? sliceEnd + len
- : sliceEnd
- }
- while (len-- > start) {
- ret[len - start] = args[len];
- }
- return ret;
- }
|