open-index/open-npm huggingface dataset:
npm package: @salestrip/env
Description: Environment variable management and utilities
Author: SalesTrip Limited
Latest version: 2.0.0

# @salestrip/env

Environment variable management and utilities.

## Install

```bash
npm i @salestrip/env
```

## Usage

Please refer to the test suite for more details.

```js
const env = require('@salestrip/env')

// access process.env.NODE_ENV
const NODE_ENV = env.get('NODE_ENV')

// sets FOO_BAR to 'whatever' if process.env.FOO_BAR is undefined
const FOO_BAR = env.get('FOO_BAR', 'whatever')

// sets FOO_BAR and process.env.FOO_BAR to 'whatever'
const FOO_BAR = env.set('FOO_BAR', 'whatever')

// deletes process.env.FOO_BAR and returns undefined
env.set('FOO_BAR')

// sets FOO_BAR and process.env.FOO_BAR to 'whatever' if process.env.FOO_BAR is undefined
const FOO_BAR = env.ensure('FOO_BAR', 'whatever')

// if process.env.FOO_BAR is 'something' sets FOO_BAR to 'something' (ignores fallback value)
const FOO_BAR = env.ensure('FOO_BAR', 'whatever')

// sets DB_URL and throws helpful error if process.env.DB_URL is undefined
const DB_URL = env.need('DB_URL')
```

## Release

To release a new version, use npm. Using `npm version` will update the version in `package.json` before committing the resulting file change to git and adding the appropriate git tag. Pushing a tagged version to `origin` will trigger a CI deployment to the npm registry.

To release a **bugfix** update the **patch version**.

```bash
npm version patch
git push
git push --tags
```

To release a **feature** update the **minor version**.

```bash
npm version minor
git push
git push --tags
```

To release a **breaking change** update the **major version**.

```bash
npm version major
git push
git push --tags
```

## License

Copyright © 2018-2019 SalesTrip Limited. All rights reserved.
npm package: @salestrip/eslint-config
Description: SalesTrip ESLint configuration
Author: SalesTrip Limited
Latest version: 2.2.0

# @salestrip/eslint-config

If you'd like to add or change an eslint rule open a PR and use gh-polls to solicit team voting: https://app.gh-polls.com/.

## Install

Install peer dependencies along with the module.

```text
npm i -D eslint
npm i -D eslint-plugin-jest
npm i -D eslint-plugin-prettier
npm i -D prettier
npm i -D prettier-eslint-cli
npm i -D @salestrip/eslint-config
```

## Use

Create the following `.eslintrc` file in your project root.

```json
{
  "extends": "@salestrip",
  "root": true
}
```

Then create a `test/.eslintrc` file with the following content.

```json
{
  "extends": "@salestrip/eslint-config/configs/jest"
}
```

This module provides a `format` binary that executes prettier code formatting followed by an eslint 'stroustrup' brace style and property quote corrections to align with eslint config. Add the following npm task to your `package.json`.

```json
"scripts": {
  "format": "format '{lib,test}/**/*.js'"
}
```

## Lint

A pre-lint script symlinks the project to itself so you can dog food the config settings while a post-lint script removes the symlinks. Note that this would remove any existing global symlink so you would need to run `npm link` again to restore it.

```text
npm run lint
```
npm package: @salestrip/mongodb
Description: SalesTrip Engine MongoDB adapter
Author: SalesTrip Limited
Latest version: 0.4.4

# @salestrip/mongodb

[![Codefresh build status](https://g.codefresh.io/api/badges/pipeline/salestrip/mongodb%2Fmongodb?branch=master&key=eyJhbGciOiJIUzI1NiJ9.NWIxOGIyMWNlMjZmNGMwMDAxZTE5MDY1.oEsGHB32WQHF0m7CSbmuJY3eUH5HAx0sxVI6TBF3gsk&type=cf-1)](https%3A%2F%2Fg.codefresh.io%2Fpipelines%2Fmongodb%2Fbuilds%3FrepoOwner%3Dsalestrip%26repoName%3Dops%26serviceName%3Dsalestrip%252Fops%26filter%3Dtrigger%3Abuild~Build%3Bbranch%3Amaster%3Bpipeline%3A5e26dcd1716cb6afedfa731e~mongodb)

SalesTrip Engine MongoDB adapter.

## Install

```bash
npm i -S bluebird mongodb ramda @salestrip/mongodb
```

## Notes

- Check peer-dependencies for other peers a client may need to install.
- Format of DB_URL env var is `mongodb://localhost:27017/ste|mongodb://localhost:27017/test?retryWrites=true`.
- Will export two instances named `steDb` and `testDb`.

## Release

To release a new version, use npm. Using `npm version` will update the version in `package.json` before committing the resulting file change to git and adding the appropriate git tag. Pushing a tagged version to `origin` will trigger a CI deployment to the npm registry.

To release a **bugfix** update the **patch version**.

```bash
npm version patch
git push
git push --tags
```

To release a **feature** update the **minor version**.

```bash
npm version minor
git push
git push --tags
```

To release a **breaking change** update the **major version**.

```bash
npm version major
git push
git push --tags
```

## License

Copyright © 2019 SalesTrip Limited. All rights reserved.
npm package: @salestrip/string
Description: String utilities
Author: SalesTrip Limited
Latest version: 1.1.0

# @salestrip/string

[![Codefresh build status](https://g.codefresh.io/api/badges/pipeline/salestrip/salestrip%2Fstring%2Fstring?branch=master&key=eyJhbGciOiJIUzI1NiJ9.NWIxOGIyMWNlMjZmNGMwMDAxZTE5MDY1.oEsGHB32WQHF0m7CSbmuJY3eUH5HAx0sxVI6TBF3gsk&type=cf-1)](https://g.codefresh.io/pipelines/string/builds?repoOwner=salestrip&repoName=string&serviceName=salestrip%2Fstring&filter=trigger:build~Build;branch:master;pipeline:5c5dc60156bdba1c077d1308~string)

String utilities.

## Install

```bash
npm i -S @salestrip/string
```

## Usage

Some example uses are included below including some of the domain-specific behaviours. Please refer to the test suite for further examples.

```js
const string = require('@salestrip/string')

string.camelize('some-string.type') // 'someStringType'

string.constantize('some-str.type') // 'SOME_STR_TYPE'

string.titleize('man from uncle') // 'Man from Uncle'

string.singularize('travellers') // 'person'

string.pluralize('traveller') // 'people'
```

## Release

To release a new version, use npm. Using `npm version` will update the version in `package.json` before committing the resulting file change to git and adding the appropriate git tag. Pushing a tagged version to `origin` will trigger a CI deployment to the npm registry.

To release a **bugfix** update the **patch version**.

```bash
npm version patch
git push
git push --tags
```

To release a **feature** update the **minor version**.

```bash
npm version minor
git push
git push --tags
```

To release a **breaking change** update the **major version**.

```bash
npm version major
git push
git push --tags
```

## License

Copyright © 2019 SalesTrip Limited. All rights reserved.
npm package: @salestrip/stub
Description: A simple stub helper for Jest
Author: SalesTrip Limited
Latest version: 2.2.1

# @salestrip/stub

[![Build Status](https://drone.stdo.io/api/badges/salestrip/stub/status.svg)](https://drone.stdo.io/salestrip/stub)

A simple stub helper for Jest.

## Install

```text
npm i -D @salestrip/stub
```

## Usage

```js
const stub = require('@salestrip/stub')
const fooModule = require('modules/foo.module')

beforeEach(() => {
  stub(fooModule, 'method')
})

afterEach(() => {
  fooModule.method.restore()
})

it('resolves', () => {
  fooModule.method.resolves('value')
  return expect(fooModule.method()).resolves.toBe('value')
})

it('resolves once', async () => {
  fooModule.method.resolvesOnce('value')
  await expect(fooModule.method()).resolves.toBe('value')
  expect(fooModule.method()).toBeUndefined()
})

it('rejects', () => {
  fooModule.method.rejects('value')
  return expect(fooModule.method()).rejects.toBe('value')
})

it('rejects once', async () => {
  fooModule.method.rejectsOnce('value')
  await expect(fooModule.method()).rejects.toBe('value')
  expect(fooModule.method()).toBeUndefined()
})

it('returns', () => {
  fooModule.method.returns('value')
  expect(fooModule.method()).toBe('value')
})

it('returns once', () => {
  fooModule.method.returnsOnce('value')
  expect(fooModule.method()).toBe('value')
  expect(fooModule.method()).toBeUndefined()
})

it('throws', () => {
  fooModule.method.throws(new Error('value'))
  expect(fooModule.method()).toThrow('value')
})

it('throws once', () => {
  fooModule.method.throwsOnce(new Error('value'))
  expect(fooModule.method()).toThrow('value')
  expect(fooModule.method()).toBeUndefined()
})
```

## Release

To release a new version, use npm. Using `npm version` will update the version in `package.json` before committing the resulting file change to git and adding the appropriate git tag. Pushing a tagged version to `origin` will trigger a CI deployment to the npm registry.

To release a **bugfix** update the **patch version**.

```bash
npm version patch
git push
git push --tags
```

To release a **feature** update the **minor version**.

```bash
npm version minor
git push
git push --tags
```

To release a **breaking change** update the **major version**.

```bash
npm version major
git push
git push --tags
```