import arraylike from '../is/arraylike.js';
import string from '../is/string.js';
import mod from './mod.js';

/**
 *
 * @function
 * @memberof utility
 * @param {arraylike} value
 * @param {int} startIndex
 * @param {int} endIndex
 * @returns {Array}
 */
export default function slice(list, startIndex, endIndex) {
	let range = [];
	if (arraylike(list)) {
		const size = list.length;
		let start = mod(startIndex, 0, size);
		const end = mod(endIndex, 0, size) || size;
		if (string(list)) {
			range = '';
			while (start < end) {
				range += list[start];
				start += 1;
			}
			return range;
		}
		while (start < end) {
			range[range.length] = list[start];
			start += 1;
		}
	}
	return range;
}

@@ -327,20 +327,29 @@
  = %5B%5D;%0A%09
-if (
+const size = 
 arraylik
@@ -359,39 +359,37 @@
 ist)
-) %7B%0A%09%09const size = list.length;
+ && list.length;%0A%09if (size) %7B
 %0A%09%09l

increase speed