# enabled

> Check if a certain debug flag is enabled.

Latest version **2.0.0** (published 2018-10-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install enabled
pnpm add enabled
yarn add enabled
bun add enabled
```

## 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 | 2.0.0 |
| Published | 2018-10-28 |
| First published | 2015-05-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 5.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5 |
| Author | Arnout Kazemier |
| Maintainers | 3rdeden |
| Keywords | enabled, debug, diagnostics, flag, env, variable, localstorage |

## Links

- npm: https://www.npmjs.com/package/enabled
- Repository: https://github.com/3rd-Eden/enabled
- Homepage: https://github.com/3rd-Eden/enabled#readme
- Issues: https://github.com/3rd-Eden/enabled/issues
- npm.io page: https://npm.io/package/enabled

## Alternatives

- [replicas-cli](https://npm.io/package/replicas-cli.md) — 3.0K weekly downloads
- [env-contract](https://npm.io/package/env-contract.md) — 133 weekly downloads
- [@openveo/api](https://npm.io/package/@openveo/api.md) — 61 weekly downloads
- [@ryniaubenpm2/cumque-error-reiciendis](https://npm.io/package/@ryniaubenpm2/cumque-error-reiciendis.md) — 54 weekly downloads
- [ts-global-type-extra](https://npm.io/package/ts-global-type-extra.md) — 11 weekly downloads

## Recent versions

- 2.0.0 (latest) — 2018-10-28
- 1.0.2 — 2016-01-15
- 1.0.1 — 2015-05-29

## README

# enabled

[![Version npm][version]](http://browsenpm.org/package/enabled)[![Build Status][build]](https://travis-ci.org/3rd-Eden/enabled)[![Dependencies][david]](https://david-dm.org/3rd-Eden/enabled)[![Coverage Status][cover]](https://coveralls.io/r/3rd-Eden/enabled?branch=master)

[version]: http://img.shields.io/npm/v/enabled.svg?style=flat-square
[build]: http://img.shields.io/travis/3rd-Eden/enabled/master.svg?style=flat-square
[david]: https://img.shields.io/david/3rd-Eden/enabled.svg?style=flat-square
[cover]: http://img.shields.io/coveralls/3rd-Eden/enabled/master.svg?style=flat-square

Enabled is a small utility that can check if certain namespace are enabled by
environment variables which are automatically transformed to regular expressions
for matching.

## Installation

The module is release in the public npm registry and can be used in browsers and
servers as it uses plain ol ES3 to make the magic work.

```
npm install --save enabled
```

## Usage

First of all make sure you've required the module using:

```js
'use strict';

var enabled = require('enabled');
```

The returned `enabled` function accepts 2 arguments.

1. `name` **string**, The namespace that should match.
2. `pattern` **string**, The pattern that the name should satisfy

It will return a boolean indication of a match.

#### Examples

```js
var flag = 'foo';

enabled('foo', flag); // true;
enabled('bar', flag); // false;

//
// Use * for wild cards.
//
var wildcard = 'foob*';

enabled('foobar', wildcard); // true;
enabled('barfoo', wildcard); // false;

//
// Use - to ignore.
//
var ignore = 'foobar,-shizzle,nizzle';

enabled('foobar', ignore); // true;
enabled('shizzle-my-nizzle', ignore); // false;
enabled('nizzle', ignore); // true;
```

## License

[MIT](./LICENSE)

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