source: node_modules/ramda-adjunct/es/isBlank.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: 1.1 KB
Line 
1import { isEmpty, isNil, anyPass, test } from 'ramda';
2import isFalse from './isFalse';
3/**
4 * Returns `true` if the given value is its type's empty value, `false`, `undefined`
5 * as well as strings containing only whitespace characters; `false` otherwise.
6 *
7 * @func isBlank
8 * @memberOf RA
9 * @since {@link https://char0n.github.io/ramda-adjunct/3.1.0|v3.1.0}
10 * @category Type
11 * @sig * -> Boolean
12 * @param {*} val The value to test
13 * @return {boolean}
14 * @see {@link https://blog.appsignal.com/2018/09/11/differences-between-nil-empty-blank-and-present.html|Differences Between #nil?, #empty?, #blank?, and #present?}
15 * @example
16 *
17 * RA.isBlank(''); //=> true
18 * RA.isBlank(' '); //=> true
19 * RA.isBlank('\t\n'); //=> true
20 * RA.isBlank({}); //=> true
21 * RA.isBlank(null); //=> true
22 * RA.isBlank(undefined); //=> true
23 * RA.isBlank([]); //=> true
24 * RA.isBlank(false); //=> true
25 * RA.isBlank('value'); //=> false
26 * RA.isBlank({ foo: 'foo' }); //=> false
27 * RA.isBlank([1, 2, 3]); //=> false
28 * RA.isBlank(true); //=> false
29 */
30var isBlank = anyPass([isFalse, isNil, isEmpty, test(/^\s+$/gm)]);
31export default isBlank;
Note: See TracBrowser for help on using the repository browser.