ramda-adjunct
Version:
Ramda Adjunct is the most popular and most comprehensive set of utilities for use with Ramda, providing a variety of useful, well tested functions with excellent documentation.
36 lines (35 loc) • 1.37 kB
JavaScript
exports.__esModule = true;
exports["default"] = void 0;
var _ramda = require("ramda");
var _isFalse = _interopRequireDefault(require("./isFalse.js"));
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
/**
* Returns `true` if the given value is its type's empty value, `false`, `undefined`
* as well as strings containing only whitespace characters; `false` otherwise.
*
* @func isBlank
* @memberOf RA
* @since {@link https://char0n.github.io/ramda-adjunct/3.1.0|v3.1.0}
* @category Type
* @sig * -> Boolean
* @param {*} val The value to test
* @return {boolean}
* @see {@link https://blog.appsignal.com/2018/09/11/differences-between-nil-empty-blank-and-present.html|Differences Between #nil?, #empty?, #blank?, and #present?}
* @example
*
* RA.isBlank(''); //=> true
* RA.isBlank(' '); //=> true
* RA.isBlank('\t\n'); //=> true
* RA.isBlank({}); //=> true
* RA.isBlank(null); //=> true
* RA.isBlank(undefined); //=> true
* RA.isBlank([]); //=> true
* RA.isBlank(false); //=> true
* RA.isBlank('value'); //=> false
* RA.isBlank({ foo: 'foo' }); //=> false
* RA.isBlank([1, 2, 3]); //=> false
* RA.isBlank(true); //=> false
*/
var isBlank = (0, _ramda.anyPass)([_isFalse["default"], _ramda.isNil, _ramda.isEmpty, (0, _ramda.test)(/^\s+$/gm)]);
var _default = exports["default"] = isBlank;
;