config-repo

2.0.3 • Public • Published

config-repo

Build Status Coverage Status Latest Version License

config-repo is a dead simple JavaScript configuration repository.

Features

  • Super simple to use.
  • API inspired by Laravel Config.
  • Lightweight package (992 B gzip).
  • Works in Node.js and web browsers.
  • Access configurations with dot notation.
  • Locking and unlocking of configurations.

Installation

Via NPM:

$ npm install --save config-repo

Via CDN: (use the config variable)

<script src="https://unpkg.com/config-repo/dist/bundle.min.js"></script>

Polyfill

This JavaScript package is using the ES2015 Object.assign() method which is not supported on older web browsers. Using a polyfill will provide that missing native method.

Overview

'use strict';
 
const config = require('config-repo');
 
// Initialize the configuration repository.
config.add(require('/path/to/config.json'));
 
// Set a configuration value.
config.set('foo', 'bar');
 
// Get a configuration value.
config.get('foo');
// => bar
 
// Get all configuration values.
config.all();
// => {..., foo: 'bar'}
 
// You can also use the helper methods.
config(require('/path/to/config.json'));
config(['foo', 'bar']);
config('foo');
config();

Resources

License

MIT © Midnite Ninja Innovations. See the LICENSE file for full license text.

Package Sidebar

Install

npm i config-repo

Weekly Downloads

2

Version

2.0.3

License

MIT

Last publish

Collaborators

  • midniteninja