# @wisersolutions/launchdarkly-node

> LaunchDarkly SDK (Node.js, server-side) wrapper intended to provide a modern API and enforce best practices.

Latest version **0.0.1** (published 2020-10-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install @wisersolutions/launchdarkly-node
pnpm add @wisersolutions/launchdarkly-node
yarn add @wisersolutions/launchdarkly-node
bun add @wisersolutions/launchdarkly-node
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.1 |
| Published | 2020-10-23 |
| First published | 2020-10-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 5.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Wiser Solutions, Inc. |
| Maintainers | mcarlotta, hon2a |

## Links

- npm: https://www.npmjs.com/package/@wisersolutions/launchdarkly-node
- Repository: https://github.com/WiserSolutions/launchdarkly
- Homepage: https://github.com/WiserSolutions/launchdarkly#readme
- Issues: https://github.com/WiserSolutions/launchdarkly/issues
- npm.io page: https://npm.io/package/@wisersolutions/launchdarkly-node

## Dependencies (2)

- [chalk](https://npm.io/package/chalk.md) ^4.1.0
- [launchdarkly-node-server-sdk](https://npm.io/package/launchdarkly-node-server-sdk.md) ^5.13.4

## Recent versions

- 0.0.1 (latest) — 2020-10-23

## README

# launchdarkly-node

[LaunchDarkly server-side SDK](https://docs.launchdarkly.com/sdk/server-side/node-js) wrapper for Node intended to provide
a modern API and enforce best practices.

## Use

Init connection to LaunchDarkly when launching your app with

```javascript
const { init } = require('@wisersolutions/launchdarkly-node')

async function startApp() {
  await init('YOUR_LAUNCH_DARKLY_APP_KEY', options)
  // … launch the rest of your app
}
```

Then request a feature variation anywhere in your app with

```javascript
const { variation } = require('@wisersolutions/launchdarkly-node')

async function handleSomeRequest(context) {
  const user = getUserFrom(context)
  const isFeature1Enabled = await variation('some-boolean-flag-key', user)
  const feature2Variation = await variation('some-multi-variant-flag-key', user, 'default-variant')
  
  if (!isFeature1Enabled) return /* … */

  switch (feature2Variation) {
    case 'variant-one': return /* … */
    case 'variant-two': return /* … */
    case 'default-variant':
    default: return /* … */
  }
}
```

See [SDK docs](https://docs.launchdarkly.com/sdk/server-side/node-js) for argument details.

## Development

### Install

Install dependencies using:

```sh
npm install
```

### Develop

After you modify sources, run the following (or set up your IDE to do it for you):

- format the code using `npm run format`
- lint it using `npm run lint`
- test it using `npm test`

and fix the errors, if there are any.

### Publish

Publishing is done in two steps:

1. Create a new version tag and push it to the repository:
    ```sh
    npm version <patch|minor|major>
    git push --follow-tags
    ```
1. Build and publish the new version as a npm package:
    ```sh
    npm publish --access public
    ```

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