【文件属性】:
文件名称:not-defined:检查是否未定义foo,即undefined,null,空字符串,数组,对象或NaN
文件大小:4KB
文件格式:ZIP
更新时间:2021-05-07 01:59:36
JavaScript
没有定义的
检查是否未定义foo,即undefined,null,空字符串,数组,对象或NaN
|
安装
npm install not-defined
用法
此代码段
import notDefined from 'not-defined'
if ( notDefined ( foo ) ) {
// do something, usually throw a TypeError
}
等效于以下伪代码
if (foo is not defined, i.e. is null, undefined, NaN, an empty string, array or object) {
// do something, usually throw a TypeError
}
您还可以使用更简短但仍具有语义的形式,例如
import no from 'not-defined'
if (
【文件预览】:
not-defined-main
----not-defined.cjs(190B)
----not-defined.js(190B)
----test.js(736B)
----package.json(838B)
----LICENSE(1KB)
----package-lock.json(74B)
----.npmignore(8B)
----index.d.ts(90B)
----README.md(2KB)