Skip to content

Latest commit

 

History

History
59 lines (36 loc) · 1.61 KB

File metadata and controls

59 lines (36 loc) · 1.61 KB

Js Config Helper

Latest Version on NPM Software License

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

Usage

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

Licence This package is Treeware. If you use it in production, then we ask 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.