Skip to content

Really simple and lightweight config helper using dotnotation inspired by Laravel

Notifications You must be signed in to change notification settings

uptoolkit/js-config-helper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Really simple and lightweight config helper using dotnotation inspired by Laravel

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published