New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

lengthy

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lengthy

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

latest
Source
npmnpm
Version
1.0.4
Version published
Maintainers
1
Created
Source

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

Keywords

array

FAQs

Package last updated on 20 May 2016

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