@pacote/non-empty-array
TypeScript icon, indicating that this package has built-in type declarations

0.3.2 • Public • Published

@pacote/non-empty-array

version minified minified + gzip

An array type guaranteed to have at least one element.

The module consumes and returns plain JavaScript arrays, but is typed to prevent the TypeScript compiler from handling arrays that might be empty.

One instance where non-empty arrays are useful is when combined with @pacote/result to create a Validation data type that accumulates multiple errors as Result<T, NonEmptyArray<Error>>. This is because a failing computation must have at least one error.

Installation

yarn add @pacote/non-empty-array

License

MIT © Luís Rodrigues.

Readme

Keywords

none

Package Sidebar

Install

npm i @pacote/non-empty-array

Weekly Downloads

0

Version

0.3.2

License

MIT

Unpacked Size

19 kB

Total Files

13

Last publish

Collaborators

  • goblindegook