https://github.com/codewell/is-defined
Check if a value is defined
https://github.com/codewell/is-defined
Last synced: 29 days ago
JSON representation
Check if a value is defined
- Host: GitHub
- URL: https://github.com/codewell/is-defined
- Owner: codewell
- License: mit
- Created: 2019-11-05T14:40:03.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-03-04T05:06:54.000Z (over 3 years ago)
- Last Synced: 2025-02-10T22:29:44.670Z (over 1 year ago)
- Language: JavaScript
- Size: 394 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# @codewell/is-defined
## Intallation
```
npm install @codewell/is-defined
```
## Basic usage
```JavaScript
import { isDefined } from '@codewell/is-defined';
isDefined(undefined); // false
isDefined(null); // false
isDefined(NaN); // false
isDefined(1); // true
isDefined("foo"); // true
isDefined(() => {}); // true
isDefined([]); // true
isDefined({}); // true
isDefined(1, "foo", []) // => true
isDefined(1, "foo", null) // => false
isDefined() // Throws error
```