Socket
Book a DemoInstallSign in
Socket

array-max-length

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

array-max-length

Returns a new array with the given maximum length

1.0.1
Source
npmnpm
Version published
Weekly downloads
4
Maintainers
1
Weekly downloads
 
Created
Source

array-max-length Build Status

Returns a new array with the given maximum length

Install

$ npm install --save array-max-length

Usage

var arrayMaxLength = require('array-max-length');
var arr = [1, 2, 3, 4, 5];

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

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

API

arrayMaxLength(input, length)

Returns the new array.

input

Type: array

length

Type: number

The maximum length of the array.

License

MIT © Andreas Gillström

Keywords

arr

FAQs

Package last updated on 05 Sep 2015

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

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.