Accepting Language Config Environment
Accepting Language Config Environment - "Alice"
Human friendly, machine editable, JSON-like config file format. Takes the JSON out of humans' nightmares.
Extends JSON to allow for:
- Regular expressions
- Relaxed identifier and syntax handling
// Section 1. Global configcontent: "foo"// Section 2. Environment config// WARN: A meaningful here be dragons commentotherContent:// Note that trailing spaces and single quotes don't cause mass chaos'see!'
npm install --save alce
var ALCE = require'alce';var config = ALCEparseconfigSource meta: true;configset'key' 'new value';configtoString;configtoObject;
Parses a string containing a ACLE source file. Returns an ACLE object.
configSource: String representation of the configuration file
options: Options hash.
object: Object to convert to a string
Returns the ACLE or primitive value stored on the object under a given key.
undefined if no key exists.
id converting to an ACLE object as necessary. If replacing an existing value, the formatting of that value will be maintained. If creating a new value, or child values, will use the rules defined in the
Removes the key specified by
ACLE instances representing arrays additionally implement:
All of which behave as they would if operating on an normal array.
Returns the current config node contents in as close to the user's input format as possible.
Formatters control how newly created nodes are rendering. The may modify the
and if applicable
innerPrologue, fields on the new objects to control the formatting around the new object.
Called for both parsed and new objects, allowing for the formatter to determine any state information necessary.
if parentobjectindent = exportscalcIndentparentpreamble || '' + parentisArray ? ' ' : '';elseobjectindent = '';
Called when a new object or array is created. Generally
parent will be an array instance or a property. The
isArray field may be used to determine if
object is an array.
objectinnerPrologue = '\n' + objectindent;
Called when a new value is inserted into an array or object instance.
insert will be pushed to the end of the
parent.children list after this operation occurs.
var indent = parentindent || ALCEcalcIndentparentpreamble;insertpreamble = parentchildrenlength ? ',' : '' + '\n ' + indent;
Called when a new property is created. This is useful for defining the
separator value for a property.
propertyseparator = ': ';
Formatter options that output two space indented data structures with trailing commas. May be passed directly into the
options parameter for both
Utilitity method for formatters. Determines the indentation that should be used for a node relative to a given prefix. This is helpful for the
inserFormatter to determine where to align new children inserted into an object.