js-config-helper
v1.3.0
Published
Really simple and light config helper using dot notation
Downloads
27
Readme
Js Config Helper
Really simple and lightweight Config helper compatible with dotnotation inspired by Laravel.
Install
You can install the package via yarn (or npm):
yarn add js-config-helper
// or
npm install js-config-helperUsage
import {Config} from 'js-form-helper';
// Instantiate a form class with some values
const config = new Config({
field1: 'value 1',
field2: 'value 2',
person: {
first_name: 'John',
last_name: 'Doe',
},
});
config('field1') // return 'value1'
config.set('field2', 'bar')
config.get('field2') // return bar instead of value2
config.get('person.first_name') // return John
config.has('person.first_name') // return true
config.all() // return all options
Security
If you discover any security related issues, please contact Daniel Sum instead of using the issue tracker.
Credits
This package is a part of the UpToolkit
License
The MIT License (MIT). Please see License File for more information.
Treeware
This package is a https://treeware.org.
If you use it in production, then we kindly propose that you buy the world a tree to thank us for our work.
By contributing to the Treeware forest you’ll be creating employment for local families and restoring wildlife habitats.
