https://github.com/codewell/and
Check if all conditions or booleans are true
https://github.com/codewell/and
Last synced: 6 days ago
JSON representation
Check if all conditions or booleans are true
- Host: GitHub
- URL: https://github.com/codewell/and
- Owner: codewell
- License: mit
- Created: 2019-11-20T13:48:37.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-01-06T02:17:55.000Z (over 3 years ago)
- Last Synced: 2025-10-24T19:56:38.105Z (8 months ago)
- Language: JavaScript
- Size: 620 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# @codewell/and
Check if all conditions or booleans are true.
First parameter should be an array of booleans. Second determines what should be returned if the input is `[]`, `undefied` or `null`. Options are `false`, `'false'` or `throw`.
## Installation
```
npm install @codewell/and
```
## Basic usage
```JavaScript
import and from '@codewell/and';
and([true, true, true]) // => true
and([true, true, false]) // => false
and([]) // => true
and([], 'false') // => false
and([], false) // => false
and([], 'throw') // => throws error
and(undefined, 'false') // => false
and(undefined, false) // => false
and(undefined, 'throw') // => throws error
and(null, 'false') // => false
and(null, false) // => false
and(null, 'throw') // => throws error
```