@unction/compact
TypeScript icon, indicating that this package has built-in type declarations

4.8.0 • Public • Published

@unction/compact

Tests Stability Dependencies

ListType<A | null> | RecordType<unknown, A | null> => Array | Set | Record<string | number | symbol, B> | Map<B, A> | string

Takes a collection (Array or Object) and returns a copy of that value without null or undefined values.

avatarUrls // => [null, "/1.jpg", null, "/3.jpg"]
compact(avatarUrls)  // => ["/1.jpg", "/3.jpg"]

user // {"avatar": null, "name": "Kurtis Rainbolt-Greene"}
compact(head(user)) // {"name": "Kurtis Rainbolt-Greene"}

Readme

Keywords

Package Sidebar

Install

npm i @unction/compact

Weekly Downloads

32

Version

4.8.0

License

SEE LICENSE IN LICENSE

Unpacked Size

15.4 kB

Total Files

7

Last publish

Collaborators

  • krainboltgreene