# config-for-dev

> It is module can help you to makes easier a works with your settings.

Latest version **1.2.0** (published 2017-11-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install config-for-dev
pnpm add config-for-dev
yarn add config-for-dev
bun add config-for-dev
```

## 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.2.0 |
| Published | 2017-11-08 |
| First published | 2017-08-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=6.11.2 |
| Dependencies | 3 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | demon-php |
| Maintainers | demon-php |
| Keywords | config, gulp, development, gulp, configuration, npm, module, configuration |

## Links

- npm: https://www.npmjs.com/package/config-for-dev
- Repository: https://github.com/demon-php/config-for-dev
- Homepage: https://github.com/demon-php/config-for-dev#readme
- Issues: https://github.com/demon-php/config-for-dev/issues
- npm.io page: https://npm.io/package/config-for-dev

## Dependencies (3)

- [error](https://npm.io/package/error.md) ^7.0.2
- [lodash](https://npm.io/package/lodash.md) ^4.17.4
- [string-template](https://npm.io/package/string-template.md) ^1.0.0

## 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

- 1.2.0 (latest) — 2017-11-08
- 1.1.0 — 2017-08-25
- 1.0.1 — 2017-08-22
- 1.0.0 — 2017-08-21

## README

# Config for dev #

It is module can help you to makes easier a works with your settings.


## Basic use


```javascript

'use strict';  

var configForDev = require('config-for-dev');
var config;
/**
* @param {(array|object)} data - array or object where settings is contained
* @returns {object} - instance of config-for-dev/app/index
*/
config = configForDev.createConfig({
    prop: {
        prop2: 'value'
    }
});
// ======== OR =========
/**
* @param {string} filePath - path to file with settings.
* @returns {object} - instance of config-for-dev/app/index
*/
config = configForDev.createConfigFromFile('any-path-to-file/settings.json');

config.getByNamespace('prop.prop2'); // return "value"

```

See [string-template](https://www.npmjs.com/package/string-template)

```javascript

var config = configForDev.createConfig({
    prop: {
        prop2: '{value}'
    }
});
config.template({value: 'value'});
config.getByNamespace('prop.prop2'); // return "value"

```

 
## Methods

```javascript

/**
 * set value by string
 * @param {string} namespaceString - example: "obj1.param1[0].val1"
 * @param {*} value
 */
Application.prototype.set(namespaceString, value);

/**
 * remove value by string
 * @param {string} namespaceString - example: "obj1.param1[0].val1"
 */
Application.prototype.remove(namespaceString);

/**
 * @param {string} namespaceString - example: "obj1.param1[0].val1"
 * @param {*} defaultValue
 * @returns {*} return default value if set parameter `defaultValue` or return undefined,
 *              return undefined if data is not found
 */
Application.prototype.getByNamespace(namespaceString, defaultValue);

/**
 * @returns {(object|array)}
 */
Application.prototype.getData();

/**
 * @param {string} namespaceString - example: "obj1.param1[0].val1"
 * @returns {boolean}
 */
Application.prototype.has(namespaceString);

/**
 * return true if data is success changed
 * @param {(object|array)} dataReplace - example: {param: "value"}
 * @throws {BaseError}
 */
Application.prototype.template(dataReplace);

```

## Support
Andrey Sergovantsev <a.sergovantsev@yandex.ru>

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