utils.js 377 B

1234567891011121314
  1. function isDef(value) {
  2. return value !== undefined && value !== null;
  3. }
  4. function isObj(x) {
  5. const type = typeof x;
  6. return x !== null && (type === 'object' || type === 'function');
  7. }
  8. function isNumber(value) {
  9. return /^\d+$/.test(value);
  10. }
  11. function range(num, min, max) {
  12. return Math.min(Math.max(num, min), max);
  13. }
  14. export { isObj, isDef, isNumber, range };