Files
common/packages/util/docs/array.md
T
Jaco Greeff b5c5734c7c Add Blake2s & XXHash utility functions (#66)
* Initial split of util & util-crypto

* Add initial XXHash version

* Blake2s wit tests & documentation

* Add sha512 (from NaCl)

* Add randomBytes (from NaCl)

* Flow fixes

* Update documentation

* Update latest @polkadot/dev
2018-01-25 14:13:43 +01:00

23 lines
659 B
Markdown

# array
Utility methods that operates on arrays
- [arrayFilter](#arrayfilter) Filters undefined and (optionally) null values from an array
## arrayFilter
Filters undefined and (optionally) null values from an array
```js
arrayFilter (array: Array<mixed>, allowNulls: boolean = true): Array<mixed>
```
Returns a new array with all `undefined` values removed. Optionally, when `allowNulls = false`, it removes the `null` values as well
```js
import { arrayFilter } from '@polkadot/util';
arrayFilter([0, void 0, true, null, false, '']); // [0, true, null, false, '']
arrayFilter([0, void 0, true, null, false, ''], false); // [0, true, false, '']
```