npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

sliced

v1.0.1

Published

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

Downloads

3,593,796

Readme

#sliced

A faster alternative to [].slice.call(arguments).

Build Status

Example output from benchmark.js

Array.prototype.slice.call x 1,401,820 ops/sec ±2.16% (90 runs sampled)
[].slice.call x 1,313,116 ops/sec ±2.04% (96 runs sampled)
cached slice.call x 10,297,910 ops/sec ±1.81% (96 runs sampled)
sliced x 19,906,019 ops/sec ±1.23% (89 runs sampled)
fastest is sliced

Array.prototype.slice.call(arguments, 1) x 1,373,238 ops/sec ±1.84% (95 runs sampled)
[].slice.call(arguments, 1) x 1,395,336 ops/sec ±1.36% (93 runs sampled)
cached slice.call(arguments, 1) x 9,926,018 ops/sec ±1.67% (92 runs sampled)
sliced(arguments, 1) x 20,747,990 ops/sec ±1.16% (93 runs sampled)
fastest is sliced(arguments, 1)

Array.prototype.slice.call(arguments, -1) x 1,319,908 ops/sec ±2.12% (91 runs sampled)
[].slice.call(arguments, -1) x 1,336,170 ops/sec ±1.33% (97 runs sampled)
cached slice.call(arguments, -1) x 10,078,718 ops/sec ±1.21% (98 runs sampled)
sliced(arguments, -1) x 20,471,474 ops/sec ±1.81% (92 runs sampled)
fastest is sliced(arguments, -1)

Array.prototype.slice.call(arguments, -2, -10) x 1,369,246 ops/sec ±1.68% (97 runs sampled)
[].slice.call(arguments, -2, -10) x 1,387,935 ops/sec ±1.70% (95 runs sampled)
cached slice.call(arguments, -2, -10) x 9,593,428 ops/sec ±1.23% (97 runs sampled)
sliced(arguments, -2, -10) x 23,178,931 ops/sec ±1.70% (92 runs sampled)
fastest is sliced(arguments, -2, -10)

Array.prototype.slice.call(arguments, -2, -1) x 1,441,300 ops/sec ±1.26% (98 runs sampled)
[].slice.call(arguments, -2, -1) x 1,410,326 ops/sec ±1.96% (93 runs sampled)
cached slice.call(arguments, -2, -1) x 9,854,419 ops/sec ±1.02% (97 runs sampled)
sliced(arguments, -2, -1) x 22,550,801 ops/sec ±1.86% (91 runs sampled)
fastest is sliced(arguments, -2, -1)

Benchmark source.

##Usage

sliced accepts the same arguments as Array#slice so you can easily swap it out.

function zing () {
  var slow = [].slice.call(arguments, 1, 8);
  var args = slice(arguments, 1, 8);

  var slow = Array.prototype.slice.call(arguments);
  var args = slice(arguments);
  // etc
}

install

npm install sliced

LICENSE