3 var toInteger = require('../../../number/to-integer')
4 , toPosInt = require('../../../number/to-pos-integer')
5 , isPlainArray = require('../../is-plain-array')
7 , isArray = Array.isArray, slice = Array.prototype.slice
8 , hasOwnProperty = Object.prototype.hasOwnProperty, max = Math.max;
10 module.exports = function (start, end) {
11 var length, result, i;
12 if (!this || !isArray(this) || isPlainArray(this)) {
13 return slice.apply(this, arguments);
15 length = toPosInt(this.length);
16 start = toInteger(start);
17 if (start < 0) start = max(length + start, 0);
18 else if (start > length) start = length;
19 if (end === undefined) {
23 if (end < 0) end = max(length + end, 0);
24 else if (end > length) end = length;
26 if (start > end) start = end;
27 result = new this.constructor(end - start);
29 while (start !== end) {
30 if (hasOwnProperty.call(this, start)) result[i] = this[start];