JSPM

lengthy

1.0.4
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1
  • Score
    100M100P100Q32128F
  • License MIT

Just like ruby's times, but with no hacky prototype stuff.

Package Exports

  • lengthy

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (lengthy) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

lengthy-header

Build Status

Lengthy provides a similar mechanism to Ruby's times, but without extending the prototype of number.

Although you can create arrays at a certain length using

Array(5)

you can't iterate over these. This is kinda annoying because you can't do stuff like this:

Array(5).map(() => Math.random() * 5)

Which is pretty useful.

Lengthy saves the day with simple syntax:

Lengthy(5)

So you can create all kinds of fun one liners.

const randData = Lengthy(1000).map((val, i) => Math.PI * i)

Lengthy sets the value of the array to the same as the key, this means that you can rewrite the above a little simpler:

const randData = Lengthy(1000).map(i => Math.PI * i)

Good times 🙂️

npm install lengthy