source: node_modules/ramda-adjunct/src/isNilOrEmpty.js

main
Last change on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago

Initial commit

  • Property mode set to 100644
File size: 832 bytes
Line 
1import { either, isEmpty, isNil, curryN } from 'ramda';
2
3/**
4 * Returns `true` if the given value is its type's empty value, `null` or `undefined`.
5 *
6 * @func isNilOrEmpty
7 * @memberOf RA
8 * @since {@link https://char0n.github.io/ramda-adjunct/0.4.0|v0.4.0}
9 * @category Type
10 * @sig * -> Boolean
11 * @param {*} val The value to test
12 * @return {boolean}
13 * @see {@link http://ramdajs.com/docs/#isEmpty|R.isEmpty}, {@link http://ramdajs.com/docs/#isNil|R.isNil}
14 * @example
15 *
16 * RA.isNilOrEmpty([1, 2, 3]); //=> false
17 * RA.isNilOrEmpty([]); //=> true
18 * RA.isNilOrEmpty(''); //=> true
19 * RA.isNilOrEmpty(null); //=> true
20 * RA.isNilOrEmpty(undefined): //=> true
21 * RA.isNilOrEmpty({}); //=> true
22 * RA.isNilOrEmpty({length: 0}); //=> false
23 */
24const isNilOrEmpty = curryN(1, either(isNil, isEmpty));
25
26export default isNilOrEmpty;
Note: See TracBrowser for help on using the repository browser.