# @tridnguyen/config

> Import config from file safely with defaults

Latest version **2.3.1** (published 2015-11-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install @tridnguyen/config
pnpm add @tridnguyen/config
yarn add @tridnguyen/config
bun add @tridnguyen/config
```

## 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.3.1 |
| Published | 2015-11-05 |
| First published | 2015-07-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 5 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Tri Nguyen |
| Maintainers | tridnguyen |
| Keywords | config, require, defaults, assign, extend |

## Links

- npm: https://www.npmjs.com/package/@tridnguyen/config
- Repository: https://github.com/tnguyen14/config
- Homepage: https://github.com/tnguyen14/config#readme
- Issues: https://github.com/tnguyen14/config/issues
- npm.io page: https://npm.io/package/@tridnguyen/config

## Dependencies (5)

- [caller](https://npm.io/package/caller.md) ^1.0.0
- [lodash.assign](https://npm.io/package/lodash.assign.md) ^3.2.0
- [better-console](https://npm.io/package/better-console.md) ^0.2.4
- [lodash.isobject](https://npm.io/package/lodash.isobject.md) ^3.0.2
- [lodash.isstring](https://npm.io/package/lodash.isstring.md) ^3.0.1

## Alternatives

- [jsforce](https://npm.io/package/jsforce.md) — 851.2K weekly downloads
- [react-native-qrcode-svg](https://npm.io/package/react-native-qrcode-svg.md) — 693.5K weekly downloads
- [@salesforce/plugin-data](https://npm.io/package/@salesforce/plugin-data.md) — 394.9K weekly downloads
- [@backstage/plugin-search-common](https://npm.io/package/@backstage/plugin-search-common.md) — 308.5K weekly downloads
- [@chain-registry/types](https://npm.io/package/@chain-registry/types.md) — 38.4K weekly downloads

## Recent versions

- 2.3.1 (latest) — 2015-11-05
- 2.3.0 — 2015-11-04
- 2.2.2 — 2015-07-22
- 2.2.1 — 2015-07-22
- 2.2.0 — 2015-07-22
- 1.2.0 — 2015-07-08
- 1.0.1 — 2015-07-08
- 1.0.0 — 2015-07-02

## README

# config
> Import config from file safely with defaults

## Installation

```sh
:; npm install --save @tridnguyen/config
```

## Usage

```js
var config = require('@tridnguyen/config');

var options = config({
	a: 'default',
	b: 'value'
}, 'config.json');
```
### Options
**`config(defaults, configPath, opts)`**

- **defaults** {Object} - default options for config. **Defaults to `{}`**
- **configPath** {String} - the path to the config file. It could be either a JSON or JS file
- **opts.caller** {Boolean} - whether the config file path is relative to the script that calls `config`, or relative to the current working directory ([`process.cwd()`](https://nodejs.org/api/process.html#process_process_cwd)). **Defaults to `true`**
- **opts.verbose** {Boolean} - verbose **Defaults to `false`**

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