|
|
il y a 5 ans | |
|---|---|---|
| dist | il y a 6 ans | |
| example | il y a 6 ans | |
| .gitignore | il y a 6 ans | |
| .npmignore | il y a 6 ans | |
| .snyk | il y a 6 ans | |
| README.md | il y a 6 ans | |
| lofig.js | il y a 6 ans | |
| package-lock.json | il y a 5 ans | |
| package.json | il y a 5 ans | |
| webpack.config.js | il y a 6 ans |
npmjs.com/package/config for client side JavaScript
npm install lofig --save --production
You can also use https://unpkg.com/lofig@latest/dist/lofig.min.js.
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');
// return property
await lofig.get('secret');
// NOTE: You can also use callbacks e.g.
lofig.get('secret', res => {
console.log('secret', res);
})
See the example folder for more details.