types.ts 739 B

12345678910111213141516171819
  1. import { isArray, isObject } from '@vue/shared'
  2. import { isNil } from 'lodash-unified'
  3. export { isArray, isFunction, isObject, isString, isDate, isPromise, isSymbol } from '@vue/shared'
  4. export { isBoolean, isNumber } from '@vueuse/core'
  5. export { isVNode } from 'vue'
  6. export const isUndefined = (val: any): val is undefined => val === undefined
  7. export const isEmpty = (val: unknown) => (!val && val !== 0) || (isArray(val) && val.length === 0) || (isObject(val) && !Object.keys(val).length)
  8. export const isElement = (e: unknown): e is Element => {
  9. if (typeof Element === 'undefined') return false
  10. return e instanceof Element
  11. }
  12. export const isPropAbsent = (prop: unknown): prop is null | undefined => {
  13. return isNil(prop)
  14. }