Socket
Socket
Sign inDemoInstall

array-max-length

Package Overview
Dependencies
0
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    array-max-length

Returns a new array with the given maximum length


Version published
Weekly downloads
4
increased by33.33%
Maintainers
1
Install size
2.65 kB
Created
Weekly downloads
 

Readme

Source

array-max-length Build Status

Returns a new Array with the given maximum length

Install

$ npm install array-max-length

Usage

const arrayMaxLength = require('array-max-length');

const arr = [1, 2, 3, 4, 5];

arrayMaxLength(arr, 2);
// => [1, 2]

arrayMaxLength(arr, 10);
// => [1, 2, 3, 4, 5]

API

arrayMaxLength(input, length)

Returns a new Array with the given length.

input

Type: Array

Input to return the new Array from.

length

Type: number

The maximum length of the Array.

License

MIT © Andreas Gillström

Keywords

FAQs

Last updated on 30 Oct 2017

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc