提交学习笔记专用
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
672 B

  1. import { isBigInt } from './isBigInt.js';
  2. import { isBoolean } from './isBoolean.js';
  3. import { isNull } from './isNull.js';
  4. import { isNumber } from './isNumber.js';
  5. import { isString } from './isString.js';
  6. import { isSymbol } from './isSymbol.js';
  7. import { isUndefined } from './isUndefined.js';
  8. /**
  9. * Returns whether the payload is a primitive type (eg. Boolean | Null | Undefined | Number | String
  10. *
  11. * | Symbol)
  12. */
  13. export function isPrimitive(payload) {
  14. return (isBoolean(payload) ||
  15. isNull(payload) ||
  16. isUndefined(payload) ||
  17. isNumber(payload) ||
  18. isString(payload) ||
  19. isSymbol(payload) ||
  20. isBigInt(payload));
  21. }