CoolFace
Datasetpublic

basant307/AI_Governance_Project

sourceHugging Faceapache-2.0updated 2mo agoView on Hugging Face
0likes45downloads
slice.js38 linesDownload Raw Back to lodash-es
1import baseSlice from './_baseSlice.js';2import isIterateeCall from './_isIterateeCall.js';3import toInteger from './toInteger.js';4 5/**6 * Creates a slice of `array` from `start` up to, but not including, `end`.7 *8 * **Note:** This method is used instead of9 * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are10 * returned.11 *12 * @static13 * @memberOf _14 * @since 3.0.015 * @category Array16 * @param {Array} array The array to slice.17 * @param {number} [start=0] The start position.18 * @param {number} [end=array.length] The end position.19 * @returns {Array} Returns the slice of `array`.20 */21function slice(array, start, end) {22  var length = array == null ? 0 : array.length;23  if (!length) {24    return [];25  }26  if (end && typeof end != 'number' && isIterateeCall(array, start, end)) {27    start = 0;28    end = length;29  }30  else {31    start = start == null ? 0 : toInteger(start);32    end = end === undefined ? length : toInteger(end);33  }34  return baseSlice(array, start, end);35}36 37export default slice;38 
basant307/AI_Governance_Project · CoolFace