Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tameemsafi/pick-truthy-values
Utility function to remove any falsy values from arrays/object written in typescript
https://github.com/tameemsafi/pick-truthy-values
js library npm typescript utility
Last synced: 23 days ago
JSON representation
Utility function to remove any falsy values from arrays/object written in typescript
- Host: GitHub
- URL: https://github.com/tameemsafi/pick-truthy-values
- Owner: tameemsafi
- License: mit
- Created: 2019-03-02T09:31:55.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-03-03T09:44:52.000Z (over 5 years ago)
- Last Synced: 2024-09-25T16:27:53.467Z (about 1 month ago)
- Topics: js, library, npm, typescript, utility
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/pick-truthy-values
- Size: 67.4 KB
- Stars: 3
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# pickTruthyValues
[![CircleCI](https://circleci.com/gh/tameemsafi/pick-truthy-values/tree/master.svg?style=svg)](https://circleci.com/gh/tameemsafi/pick-truthy-values/tree/master)
Utility function which removes any falsy values from arrays/objects written in typescript.
## Examples
```js
import { pickTruthyValues } from 'pick-truthy-values'pickTruthyValues({
a: null,
b: undefined,
c: '',
e: [],
})// => {}
pickTruthyValues({
a: {
b: [
{ c: null }
]
}
})// => {}
pickTruthyValues({
a: {
b: [
{ c: null },
{ d: 'test' }
]
}
})// => { a: { b: [ { d: 'test' } ] } }
pickTruthyValues([ 1, 2, 3, null, 4, 5, undefined, 6, false ])
// => [ 1, 2, 3, 4, 5, 6, false ]
```