Skip to content

判断是否为undefined

一、源码参考

js

import getTypeOf from './getTypeOf'

export const isUndefined = (target) => {
  return target === undefined && typeof target === 'undefined'  && getTypeOf(target) === 'undefined'
}

二、示例

js
import { isUndefined } from 'vivace-tool'
console.log(isUndefined()) // true
console.log(isUndefined({})) // false

Released under the MIT License.