2.0.0 • Published 8 years ago
apemanconst v2.0.0
apemanconst
Demo of service project.
Installation
$ npm install apemanconst --save
Usage
Create a directory with name "consts" and put const files like "en.json" there.
consts/foo.json
{
"message":"This is #{myName}"
}
consts/index.js
'use strict'
const apemanconst = require('apemanconst')
// Exports consts as module.
let consts = apemanconst(__dirname, {
// Options
vars: {
myName: 'deep blue'
}
})
// Print all consts
consts.print()
module.exports = consts
Then,
'use strict'
// Require defined consts
const consts = require('./consts/index.js')
let foo = consts('foo')
console.log(foo.message) // -> "This is deep blue"
License
This software is released under the MIT License.