You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

sliced

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sliced

A faster Node.js alternative to Array.prototype.slice.call(arguments)

1.0.1
latest
Source
npmnpm
Version published
Weekly downloads
787K
-11.61%
Maintainers
1
Weekly downloads
 
Created

What is sliced?

The 'sliced' npm package is a utility that provides a simple way to slice arrays and array-like objects. It is particularly useful for converting arguments objects into arrays and for slicing arrays in a concise manner.

What are sliced's main functionalities?

Slicing Arrays

This feature allows you to slice an array from a start index to an end index. In this example, the array [1, 2, 3, 4, 5] is sliced from index 1 to index 3, resulting in [2, 3].

const sliced = require('sliced');
const array = [1, 2, 3, 4, 5];
const result = sliced(array, 1, 3);
console.log(result); // Output: [2, 3]

Slicing Arguments Object

This feature is useful for converting the arguments object into an array and slicing it. In this example, the arguments object is sliced from index 1, resulting in [2, 3, 4].

const sliced = require('sliced');
function example() {
  const args = sliced(arguments, 1);
  console.log(args); // Output: [2, 3, 4]
}
example(1, 2, 3, 4);

Other packages similar to sliced

Keywords

arguments

FAQs

Package last updated on 14 Jul 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts