isEmpty.js 840 B

123456789101112131415161718192021222324252627282930313233
  1. import _curry1 from "./internal/_curry1.js";
  2. import empty from "./empty.js";
  3. import equals from "./equals.js";
  4. /**
  5. * Returns `true` if the given value is its type's empty value; `false`
  6. * otherwise.
  7. *
  8. * @func
  9. * @memberOf R
  10. * @since v0.1.0
  11. * @category Logic
  12. * @sig a -> Boolean
  13. * @param {*} x
  14. * @return {Boolean}
  15. * @see R.empty
  16. * @example
  17. *
  18. * R.isEmpty([1, 2, 3]); //=> false
  19. * R.isEmpty([]); //=> true
  20. * R.isEmpty(''); //=> true
  21. * R.isEmpty(null); //=> false
  22. * R.isEmpty({}); //=> true
  23. * R.isEmpty({length: 0}); //=> false
  24. * R.isEmpty(Uint8Array.from('')); //=> true
  25. */
  26. var isEmpty =
  27. /*#__PURE__*/
  28. _curry1(function isEmpty(x) {
  29. return x != null && equals(x, empty(x));
  30. });
  31. export default isEmpty;