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

flatit

v1.1.1

Published

Faltten array

Downloads

169

Readme

flatit Build Status

Another implementation of array flatterization. Works recursivly down every nested array.

Usage

var flat = require('flatit');

flat([]); // []
flat([1,2,3,4,5]); // [1,2,3,4,5]
flat([1,2,3,[],4,5]); // [1,2,3,4,5]
flat([1,2,3,[4,[5],6],7,8]); // [1,2,3,4,5,6,7,8]

API

flat(array)

Returns flattened array.

Benchmarks

Run npm run bench to test it yourself.

                      flatten empty array
      11,242,685 op/s » recursive
      10,897,869 op/s » lodash
       2,562,129 op/s » flatten
      14,829,264 op/s » flatit
      15,150,337 op/s » shifting
      11,902,776 op/s » pop

                      flatten array of empty arrays
       1,813,326 op/s » recursive
         558,774 op/s » lodash
         123,880 op/s » flatten
       2,273,380 op/s » flatit
         297,519 op/s » shifting
         395,793 op/s » pop

                      flatten already flat array
       1,009,670 op/s » recursive
       2,070,110 op/s » lodash
          28,762 op/s » flatten
       2,083,666 op/s » flatit
         648,079 op/s » shifting
         921,404 op/s » pop

                      flatten single nested array
         876,355 op/s » recursive
       1,051,872 op/s » lodash
          22,871 op/s » flatten
      10,293,846 op/s » flatit
         526,062 op/s » shifting
         873,115 op/s » pop

                      flatten nested array
       1,361,593 op/s » recursive
         531,594 op/s » lodash
          29,133 op/s » flatten
         768,345 op/s » flatit
         331,482 op/s » shifting
         554,377 op/s » pop

                      flatten big array (depth 2)
           6,990 op/s » recursive
           3,761 op/s » lodash
              60 op/s » flatten
           4,237 op/s » flatit
           1,717 op/s » shifting
           3,419 op/s » pop


  Suites:  6
  Benches: 36
  Elapsed: 59,500.93 ms

License

MIT (c) 2014 Vsevolod Strukchinsky ([email protected])