Really simple and lightweight Config helper compatible with dotnotation inspired by Laravel.
You can install the package via yarn (or npm):
yarn add js-config-helper
// or
npm install js-config-helper
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
If you discover any security related issues, please contact Daniel Sum instead of using the issue tracker.
This package is a part of the UpToolkit