# normalize-bool

> Converts strings representing an on/off-state to booleans

Latest version **1.0.0** (published 2017-03-14) · MIT license · 0 weekly downloads

## Install

```sh
npm install normalize-bool
pnpm add normalize-bool
yarn add normalize-bool
bun add normalize-bool
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2017-03-14 |
| First published | 2017-03-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 10 |
| Author | Thomas Watson Steen |
| Maintainers | watson |
| Keywords | bool, boolean, on, off, enabled, disabled, convert, converter, config, environment, variable |

## Links

- npm: https://www.npmjs.com/package/normalize-bool
- Repository: https://github.com/watson/normalize-bool
- Homepage: https://github.com/watson/normalize-bool#readme
- Issues: https://github.com/watson/normalize-bool/issues
- npm.io page: https://npm.io/package/normalize-bool

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 1.0.0 (latest) — 2017-03-14

## README

# normalize-bool

Converts strings representing an on/off-state to booleans. Falsy values
and a whitelist of keywords are converted to the boolean `false`.
Everything else is considered `true`.

Useful for normalizing environment variables and other user-input to
booleans.

[![Build status](https://travis-ci.org/watson/normalize-bool.svg?branch=master)](https://travis-ci.org/watson/normalize-bool)
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](https://github.com/feross/standard)

## Installation

```
npm install normalize-bool --save
```

## Usage

```js
var bool = require('normalize-bool')

console.log(bool('no')) // => false
console.log(bool('yes')) // => true
```

## API

### `var bool = normalizeBool(value)`

Converts the input value to a boolean. Falsy values and a whitelist of
keywords are converted to the boolean `false`. Everything else is
considered `true`.

The following values are considered `false`:

- All normal [falsy values](https://developer.mozilla.org/en-US/docs/Glossary/Falsy)
- `'0'`
- `'false'`
- `'no'`
- `'off'`
- `'disabled'`

## License

MIT

---
_Source: https://npm.io/package/normalize-bool · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
