mis-configurator
v0.3.0
Published
A node module to create a Miscreated hosting.cfg file from some json
Downloads
4
Readme
mis-configurator
A node module to decode/encode a Miscreated hosting.cfg file.
Install
$ npm install --save mis-configurator
Usage
import {
createHostingCFGStringFromObject,
createObjectFromHostingCFGString
} from 'mis-configurator';
const hostingCFGString = createHostingCFGStringFromObject(mockHostingCFGObj);
const hostingCFGObj = createObjectFromHostingCFGString(mockHostingCFgString);
API
Table of Contents
saneDefaults
MisConfigurator project: mis-configurator author: Chris Sprance - csprance
MisConfigurator
Encode and decode Miscreated hosting.cfg files decode to get a simple js object / encode to get a config-String
Parameters
options
MisConfiguratorOptions (optional, defaultdefaultOptions
)
Meta
- author: Csprance - Based off of config-cfg-ini
decode
Decode a config-string
Parameters
data
string {string}
Returns Object object
encode
Encode an object no nesting section supported!
Parameters
object
Object {object}
Returns string
getDuplicatedKeys
Gets any keys that are duplicates
- @param keyValuePairs [['key1'], 'value1'], ['key2', 'value2'], ['key1', 'value3']]
Parameters
Returns Array<string> Array ['key1']
detectLineEnding
Try to detect the used line ending (windows, unix, mac)
Parameters
data
string
Returns string string
stringBeginsWithOnOfTheseStrings
Figures out if a string begins with one of the string (windows, unix, mac)
Parameters
Returns boolean string
createHostingCFGStringFromObject
This takes a javascript object and transforms it to a hosting.cfg string.
Parameters
data
Object The javascript object to transform.
Returns string a hosting.cfg string.
createObjectFromHostingCFGString
This takes a hosting.cfg string and transforms it to a javascript object
Parameters
str
string The string hosting.cfg to transform.
Returns Object a javascript object
License
MIT © csprance