array-like-slice-x
Cross-browser array-like slicer.
Last updated 7 years ago by xotic750 .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install array-like-slice-x 
SYNC missed versions from official npm registry.

Travis status Dependency status devDependency status npm version jsDelivr hits bettercodehub score Coverage Status

array-like-slice-x

Cross-browser array-like slicer.

module.exports(argsObject, [start], [end])Array

The slice() method returns a shallow copy of a portion of an array into a new array object selected from begin to end (end not included). The original array will not be modified.

Kind: Exported function
Returns: Array - A new array containing the extracted elements.

Param Type Description
argsObject Object The arguments to slice.
[start] number Zero-based index at which to begin extraction. A negative index can be used, indicating an offset from the end of the sequence. slice(-2) extracts the last two elements in the sequence. If begin is undefined, slice begins from index 0.
[end] number Zero-based index before which to end extraction. Slice extracts up to but not including end. For example, slice([0,1,2,3,4],1,4) extracts the second element through the fourth element (elements indexed 1, 2, and 3). A negative index can be used, indicating an offset from the end of the sequence. slice(2,-1) extracts the third element through the second-to-last element in the sequence. If end is omitted, slice extracts through the end of the sequence (arr.length). If end is greater than the length of the sequence, slice extracts through the end of the sequence (arr.length).

Example

import arrayLikeSlice from 'array-like-slice-x';

const args = (function() {
  return arguments;
})('Banana', 'Orange', 'Lemon', 'Apple', 'Mango');

console.log(arrayLikeSlice(args, 1, 3)); // ['Orange','Lemon']

Current Tags

  • 2.2.2                                ...           latest (5 years ago)

34 Versions

  • 2.2.2                                ...           5 years ago
  • 2.2.1                                ...           5 years ago
  • 2.2.0                                ...           5 years ago
  • 2.1.0                                ...           5 years ago
  • 2.0.27                                ...           5 years ago
  • 2.0.26                                ...           5 years ago
  • 2.0.25                                ...           5 years ago
  • 2.0.24                                ...           5 years ago
  • 2.0.23                                ...           5 years ago
  • 2.0.22                                ...           5 years ago
  • 2.0.21                                ...           5 years ago
  • 2.0.20                                ...           5 years ago
  • 2.0.19                                ...           5 years ago
  • 2.0.18                                ...           5 years ago
  • 2.0.17                                ...           5 years ago
  • 2.0.16                                ...           5 years ago
  • 2.0.15                                ...           5 years ago
  • 2.0.14                                ...           5 years ago
  • 2.0.13                                ...           5 years ago
  • 2.0.12                                ...           5 years ago
  • 2.0.11                                ...           5 years ago
  • 2.0.10                                ...           5 years ago
  • 2.0.9                                ...           5 years ago
  • 2.0.8                                ...           5 years ago
  • 2.0.7                                ...           5 years ago
  • 2.0.6                                ...           5 years ago
  • 2.0.5                                ...           5 years ago
  • 2.0.4                                ...           5 years ago
  • 2.0.3                                ...           5 years ago
  • 2.0.2                                ...           5 years ago
  • 2.0.0                                ...           5 years ago
  • 1.2.0                                ...           7 years ago
  • 1.1.0                                ...           7 years ago
  • 1.0.0                                ...           7 years ago
Maintainers (1)
Downloads
Total 0
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (5)

© 2010 - cnpmjs.org x YWFE | Home | YWFE