https://github.com/threeletters/config
Config parser
https://github.com/threeletters/config
Last synced: 5 days ago
JSON representation
Config parser
- Host: GitHub
- URL: https://github.com/threeletters/config
- Owner: ThreeLetters
- License: other
- Created: 2016-08-15T13:43:16.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2016-10-17T19:02:36.000Z (over 9 years ago)
- Last Synced: 2025-02-27T18:13:47.810Z (over 1 year ago)
- Language: JavaScript
- Size: 12.7 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![NPM] (https://img.shields.io/badge/Module-Npm-blue.svg)] (https://www.npmjs.com/package/SmartConfig)
[![Donate] (https://img.shields.io/badge/Donate-Paypal-brightgreen.svg)] (https://paypal.me/andrews54757)
[](https://travis-ci.org/AJS-development/Config)
# Config
Smart Config parser
## Usage
```
var configs = {
hello: "Jstring", // Joined string (joining spaces EG: "hello I am andrew" -> "hello I am andrew")
my: "Ostring", // Object string (spaces create new object EG: "hello I am andrew" -> object ["hello","I","am","andrew"])
name: "string", // string (no spaces. EG: "hello i am andrew" -> "hello")
is: "Oint", // Joined numbers (EG: "1 2 3 4 5" -> Object[1,2,3,4,5])
andrew: "Int" // Int (EG: "1,2,3,4,5" -> 1)
}
var default = {
hello: "blah blah blah with spaces",
my: ["I","am","an","object"],
name: "Iamastring",
is: [1,2,3,4,5],
andrew: 1
}
const ConfigLoader = require('SmartConfigs')
const configLoader = new ConfigLoader(configs,default) // default is optional
```
To parse
`configLoader.parse(string)` with FS `configLoader.parse(fs.readFileSync("./myconfigfile","utf8"))`
To stringify
`configLoader.stringify(configstostringify)` with FS `fs.writeFileSync("./myconfigfile",configLoader.stringify(configstostringify))`
## Documentation