Skip to content

A module to convert a Javascript object to a hosting.cfg file or vice a versa for Miscreated game servers

License

Notifications You must be signed in to change notification settings

csprance/mis-configurator

Repository files navigation

mis-configurator

NPM version

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, default defaultOptions)

Meta

  • author: Csprance - Based off of config-cfg-ini

decode

Decode a config-string

Parameters

Returns Object object

encode

Encode an object no nesting section supported!

Parameters

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

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

About

A module to convert a Javascript object to a hosting.cfg file or vice a versa for Miscreated game servers

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published