{"_id":"alce","_rev":"305617","name":"alce","description":"Accepting Language Config Environment","dist-tags":{"latest":"1.2.0"},"maintainers":[{"name":"kpdecker","email":"kpdecker@gmail.com"}],"time":{"modified":"2021-06-03T19:30:43.000Z","created":"2013-09-09T04:01:16.368Z","1.2.0":"2015-12-12T19:44:25.356Z","1.1.1":"2015-12-12T19:27:17.240Z","1.1.0":"2014-10-29T21:09:13.360Z","1.0.0":"2013-09-09T04:01:16.368Z"},"users":{"jbramesh":true,"nethoncho":true,"dahjelle":true,"mhaidarh":true},"repository":{"type":"git","url":"git://github.com/kpdecker/alce.git"},"versions":{"1.2.0":{"name":"alce","version":"1.2.0","description":"Accepting Language Config Environment","keywords":["json parser whitespace comments configuration"],"dependencies":{"esprima":"^1.2.0","estraverse":"^1.5.0"},"devDependencies":{"grunt":"~0.4.1","grunt-contrib-jshint":"0.x.x","grunt-mocha-cov":"0.x.x","mocha":"^2.0.0","should":"3.x.x"},"repository":{"type":"git","url":"git://github.com/kpdecker/alce.git"},"engines":{"node":">=0.8.0"},"main":"lib/alce.js","scripts":{"test":"mocha"},"bugs":{"url":"https://github.com/kpdecker/alce/issues"},"homepage":"https://github.com/kpdecker/alce#readme","directories":{"test":"test"},"license":"MIT","gitHead":"6c7057029d438e1a639769bc9a5a3e96c6bca766","_id":"alce@1.2.0","_shasum":"a8be2dacaac42494612f18dc09db691f3dea4aab","_from":".","_npmVersion":"3.3.12","_nodeVersion":"5.1.1","_npmUser":{"name":"kpdecker","email":"kpdecker@gmail.com"},"dist":{"shasum":"a8be2dacaac42494612f18dc09db691f3dea4aab","size":10026,"noattachment":false,"key":"/alce/-/alce-1.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/alce/download/alce-1.2.0.tgz"},"maintainers":[{"name":"kpdecker","email":"kpdecker@gmail.com"}],"publish_time":1449949465356,"_cnpm_publish_time":1449949465356,"_hasShrinkwrap":false},"1.1.1":{"name":"alce","version":"1.1.1","description":"Accepting Language Config Environment","keywords":["json parser whitespace comments configuration"],"dependencies":{"esprima":"^1.2.0","estraverse":"^1.5.0"},"devDependencies":{"grunt":"~0.4.1","grunt-contrib-jshint":"0.x.x","grunt-mocha-cov":"0.x.x","mocha":"^2.0.0","should":"3.x.x"},"repository":{"type":"git","url":"git://github.com/kpdecker/alce.git"},"engines":{"node":">=0.8.0"},"main":"lib/alce.js","scripts":{"test":"mocha"},"bugs":{"url":"https://github.com/kpdecker/alce/issues"},"homepage":"https://github.com/kpdecker/alce#readme","directories":{"test":"test"},"license":"MIT","gitHead":"fb96444576967b376e6f3b122b6f6ffadb402308","_id":"alce@1.1.1","_shasum":"fb303394ad5b5cf4c66daccecf8861a92aef9fea","_from":".","_npmVersion":"3.3.12","_nodeVersion":"5.1.1","_npmUser":{"name":"kpdecker","email":"kpdecker@gmail.com"},"dist":{"shasum":"fb303394ad5b5cf4c66daccecf8861a92aef9fea","size":9892,"noattachment":false,"key":"/alce/-/alce-1.1.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/alce/download/alce-1.1.1.tgz"},"maintainers":[{"name":"kpdecker","email":"kpdecker@gmail.com"}],"publish_time":1449948437240,"_cnpm_publish_time":1449948437240,"_hasShrinkwrap":false},"1.1.0":{"name":"alce","version":"1.1.0","description":"Accepting Language Config Environment","keywords":["json parser whitespace comments configuration"],"dependencies":{"esprima":"1.2.x","estraverse":"1.5.x"},"devDependencies":{"grunt":"~0.4.1","grunt-contrib-jshint":"0.x.x","grunt-mocha-cov":"0.x.x","mocha":"1.x.x","should":"3.x.x"},"repository":{"type":"git","url":"git://github.com/walmartlabs/alce.git"},"engines":{"node":">=0.8.0"},"main":"lib/alce.js","scripts":{"test":"mocha"},"gitHead":"275548079dd9b403121005d9ef2b494d5b092484","bugs":{"url":"https://github.com/walmartlabs/alce/issues"},"homepage":"https://github.com/walmartlabs/alce","_id":"alce@1.1.0","_shasum":"fabc961c6e5cdc1892bd96ac0cb724d6fcf83f39","_from":".","_npmVersion":"1.4.21","_npmUser":{"name":"kpdecker","email":"kpdecker@gmail.com"},"maintainers":[{"name":"kpdecker","email":"kpdecker@gmail.com"}],"dist":{"shasum":"fabc961c6e5cdc1892bd96ac0cb724d6fcf83f39","size":9758,"noattachment":false,"key":"/alce/-/alce-1.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/alce/download/alce-1.1.0.tgz"},"directories":{},"publish_time":1414616953360,"_cnpm_publish_time":1414616953360,"_hasShrinkwrap":false},"1.0.0":{"name":"alce","version":"1.0.0","description":"Accepting Language Config Environment","keywords":["json parser whitespace comments configuration"],"dependencies":{"esprima":"~1.0.4","estraverse":"~1.3.0"},"devDependencies":{"grunt":"~0.4.1","grunt-contrib-jshint":"~0.6.2","grunt-mocha-cov":"0.0.7","mocha":"~1.10.0","should":"~1.2.2"},"engines":{"node":">=0.8.0"},"main":"lib/alce.js","scripts":{"test":"./node_modules/.bin/mocha"},"readmeFilename":"README.md","_id":"alce@1.0.0","dist":{"shasum":"426184c98ee288d0eeac77fd63fed680b667cab6","size":9405,"noattachment":false,"key":"/alce/-/alce-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/alce/download/alce-1.0.0.tgz"},"_from":".","_npmVersion":"1.3.5","_npmUser":{"name":"kpdecker","email":"kpdecker@gmail.com"},"maintainers":[{"name":"kpdecker","email":"kpdecker@gmail.com"}],"directories":{},"publish_time":1378699276368,"_hasShrinkwrap":false,"_cnpm_publish_time":1378699276368}},"readme":"# ALCE\n\nAccepting Language Config Environment - \"Alice\"\n\nHuman friendly, machine editable, JSON-like config file format. Takes the JSON out of humans' nightmares.\n\nExtends JSON to allow for:\n\n- Comments\n- Regular expressions\n- Relaxed identifier and syntax handling\n\n## Example\n\n```javascript\n{\n  // Section 1. Global config\n  content: \"foo\",\n\n  // Section 2. Environment config\n  // WARN: A meaningful here be dragons comment\n  otherContent: [\n    // Note that trailing spaces and single quotes don't cause mass chaos\n    'see!',\n  ]\n}\n```\n\n## Usage\n\n```\nnpm install --save alce\n```\n\n```javascript\nvar ALCE = require('alce');\n\nvar config = ALCE.parse(configSource, {meta: true});\nconfig.set('key', 'new value');\nconfig.toString();\nconfig.toObject();\n```\n\n## API\n\n### ALCE.parse(configSource, options)\n\nParses a string containing a ACLE source file. Returns an ACLE object.\n\n- `configSource`: String representation of the configuration file\n- `options`: Options hash.\n  - `meta` : Set to truthy to return an editable version of the config that may be reconstructed. Falsy returns generic javascript object. See [#toObject](#toObject).\n  - Formatter options. See [Formatters](#formatters) for more info\n\n### ALCE.stringify(object, options)\n\nConverts a ACLE or javascript object to it's string representation.\n\n- `object`: Object to convert to a string\n- `options`: Formatter options when converting a javascript object. See [Formatters](#formatters) for more info.\n\n### Metadata Objects\n\n#### #get(id)\n\nReturns the ACLE or primitive value stored on the object under a given key. `undefined` if no key exists.\n\n#### #set(id, value)\n\nSets `value` to `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 `options` formatters.\n\n#### #remove(id)\n\nRemoves the key specified by `id`.\n\n#### Array-like methods\n\nACLE instances representing arrays additionally implement:\n\n- `length`\n- `push`\n- `pop`\n- `unshift`\n- `shift`\n- `splice`\n\nAll of which behave as they would if operating on an normal array.\n\n#### #toString()\n\nReturns the current config node contents in as close to the user's input format as possible.\n\n#### #toObject()\n\nReturns a generic javascript object with all config values stripped of any metadata. Useful for passing to other APIs or when metadata is not necessary.\n\n\n### Formatters\n\nFormatters control how newly created nodes are rendering. The may modify the `preamble`, `prologue`,\nand if applicable `innerPrologue`, fields on the new objects to control the formatting around the new object.\n\n\n### #seedIndent(parent, object)\n\nCalled for both parsed and new objects, allowing for the formatter to determine any state information necessary.\n\n```javascript\n  seedIndent: function(parent, object) {\n    if (parent) {\n      object.indent = exports.calcIndent(parent.preamble || '') + (parent.isArray ? '  ' : '');\n    } else {\n      object.indent = '';\n    }\n  },\n```\n\n#### #objectFormatter(parent, object)\n\nCalled 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 `parent` or `object` is an array.\n\n```javascript\n  objectFormatter: function(parent, object) {\n    object.innerPrologue = '\\n' + object.indent;\n  },\n```\n\n#### #insertFormatter(parent, insert)\n\nCalled 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.\n\n```javascript\n  insertFormatter: function(parent, insert) {\n    var indent = parent.indent || ALCE.calcIndent(parent.preamble);\n    insert.preamble = (parent.children.length ? ',' : '') + '\\n  ' + indent;\n  },\n```\n\n#### #propertyFormatter(parent, property)\n\nCalled when a new property is created. This is useful for defining the `separator` value for a property.\n\n```javascript\n  propertyFormatter: function(parent, property) {\n    property.separator = ': ';\n  }\n```\n\n#### ALCE.TWO_SPACE_FORMATTER\n\nFormatter options that output two space indented data structures with trailing commas. May be passed directly into the `options` parameter for both `parse` and `serialize`.\n\n#### ALCE.calcIndent(preamble)\n\nUtilitity 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.\n\n\n[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/walmartlabs/alce/trend.png)](https://bitdeli.com/free \"Bitdeli Badge\")\n\n","_attachments":{},"homepage":"https://github.com/kpdecker/alce#readme","bugs":{"url":"https://github.com/kpdecker/alce/issues"},"license":"MIT"}