Нет описания

Jonathan 35337e0c11 feat: .get() and .has() now use promises 5 лет назад
dist 35337e0c11 feat: .get() and .has() now use promises 5 лет назад
example 7a3795d9fb fix: updated example dir name 5 лет назад
.gitignore 7c5f218d47 chore: initial release (v1.1.2) 5 лет назад
.npmignore 7c5f218d47 chore: initial release (v1.1.2) 5 лет назад
README.md f3ca5fd131 chore: updated webpack config 5 лет назад
lofig.js 35337e0c11 feat: .get() and .has() now use promises 5 лет назад
package-lock.json f3ca5fd131 chore: updated webpack config 5 лет назад
package.json f3ca5fd131 chore: updated webpack config 5 лет назад
webpack.config.js f3ca5fd131 chore: updated webpack config 5 лет назад

README.md

lofig

npmjs.com/package/config for client side JavaScript

Installation

npm install lofig --save --production

You can also use https://unpkg.com/lofig@latest/dist/lofig.min.js.

Usage

import 'lofig' from 'lofig'; // not necessary if using CDN Link

// change config folder
lofig.folder = 'config/default.json';

// check if property exists

await lofig.has('secret');
// OR
lofig.has('secret').then(res => {
	if (res) console.log("secret is defined!");
})

// return property

await lofig.get('secret');
// OR
lofig.get('secret').then(secret => {
	if (secret) console.log("secret:", secret);
})

See example folder for more details.