{"_id":"expander","_rev":"80234","name":"expander","description":"Expand template strings in declarative configurations.","dist-tags":{"latest":"0.3.3"},"maintainers":[{"name":"tkellen","email":"tyler@sleekcode.net"}],"time":{"modified":"2021-06-03T10:25:39.000Z","created":"2013-11-06T05:31:06.027Z","0.3.3":"2014-02-21T06:56:43.866Z","0.3.2":"2014-02-20T14:49:55.294Z","0.3.1":"2014-02-11T07:54:55.605Z","0.3.0":"2014-02-10T16:46:26.535Z","0.2.2":"2013-12-15T18:31:33.170Z","0.2.1":"2013-11-21T20:17:03.639Z","0.2.0":"2013-11-08T16:54:05.234Z","0.1.0":"2013-11-06T05:31:06.027Z"},"users":{},"author":{"name":"Tyler Kellen","url":"http://goingslowly.com/"},"repository":{"type":"git","url":"git://github.com/tkellen/expander.git"},"versions":{"0.3.3":{"name":"expander","description":"Expand template strings in declarative configurations.","version":"0.3.3","homepage":"https://github.com/tkellen/expander","author":{"name":"Tyler Kellen","url":"http://goingslowly.com/"},"repository":{"type":"git","url":"git://github.com/tkellen/expander.git"},"bugs":{"url":"https://github.com/tkellen/expander/issues"},"licenses":[{"type":"MIT","url":"https://github.com/tkellen/expander/blob/master/LICENSE-MIT"}],"main":"index.js","engines":{"node":">= 0.8.0"},"scripts":{"test":"mocha -R spec test/index.js"},"devDependencies":{"mocha":"~1.17.1","chai":"~1.9.0"},"keywords":["declarative configuration"],"dependencies":{"getobject":"0.1.0","lodash":"~2.2.1"},"_id":"expander@0.3.3","dist":{"shasum":"a2c7b9ce047db2097e2b7cd4315c1e701027fb11","size":3970,"noattachment":false,"key":"/expander/-/expander-0.3.3.tgz","tarball":"http://registry.cnpm.dingdandao.com/expander/download/expander-0.3.3.tgz"},"_from":".","_npmVersion":"1.4.3","_npmUser":{"name":"tkellen","email":"tyler@sleekcode.net"},"maintainers":[{"name":"tkellen","email":"tyler@sleekcode.net"}],"directories":{},"publish_time":1392965803866,"_cnpm_publish_time":1392965803866,"_hasShrinkwrap":false},"0.3.2":{"name":"expander","description":"Expand template strings in declarative configurations.","version":"0.3.2","homepage":"https://github.com/tkellen/expander","author":{"name":"Tyler Kellen","url":"http://goingslowly.com/"},"repository":{"type":"git","url":"git://github.com/tkellen/expander.git"},"bugs":{"url":"https://github.com/tkellen/expander/issues"},"licenses":[{"type":"MIT","url":"https://github.com/tkellen/expander/blob/master/LICENSE-MIT"}],"main":"index.js","engines":{"node":">= 0.8.0"},"scripts":{"test":"mocha -R spec test/index.js"},"devDependencies":{"mocha":"~1.17.1","chai":"~1.9.0"},"keywords":["declarative configuration"],"dependencies":{"getobject":"0.1.0","lodash":"~2.2.1"},"_id":"expander@0.3.2","dist":{"shasum":"9f15a088983e9e649d52e7c0484bc1701a53c7c5","size":3846,"noattachment":false,"key":"/expander/-/expander-0.3.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/expander/download/expander-0.3.2.tgz"},"_from":".","_npmVersion":"1.3.26","_npmUser":{"name":"tkellen","email":"tyler@sleekcode.net"},"maintainers":[{"name":"tkellen","email":"tyler@sleekcode.net"}],"directories":{},"publish_time":1392907795294,"_cnpm_publish_time":1392907795294,"_hasShrinkwrap":false},"0.3.1":{"name":"expander","description":"Expand template strings in declarative configurations.","version":"0.3.1","homepage":"https://github.com/tkellen/expander","author":{"name":"Tyler Kellen","url":"http://goingslowly.com/"},"repository":{"type":"git","url":"git://github.com/tkellen/expander.git"},"bugs":{"url":"https://github.com/tkellen/expander/issues"},"licenses":[{"type":"MIT","url":"https://github.com/tkellen/expander/blob/master/LICENSE-MIT"}],"main":"index.js","engines":{"node":">= 0.8.0"},"scripts":{"test":"mocha -R spec test/index.js"},"devDependencies":{"mocha":"~1.17.1","chai":"~1.9.0"},"keywords":["declarative configuration"],"dependencies":{"getobject":"0.1.0","lodash":"~2.2.1"},"_id":"expander@0.3.1","dist":{"shasum":"5e318899f8ec6fbbadd0d5379ca058ec0cc8defe","size":3386,"noattachment":false,"key":"/expander/-/expander-0.3.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/expander/download/expander-0.3.1.tgz"},"_from":".","_npmVersion":"1.3.26","_npmUser":{"name":"tkellen","email":"tyler@sleekcode.net"},"maintainers":[{"name":"tkellen","email":"tyler@sleekcode.net"}],"directories":{},"publish_time":1392105295605,"_cnpm_publish_time":1392105295605,"_hasShrinkwrap":false},"0.3.0":{"name":"expander","description":"Expand template strings in declarative configurations.","version":"0.3.0","homepage":"https://github.com/tkellen/expander","author":{"name":"Tyler Kellen","url":"http://goingslowly.com/"},"repository":{"type":"git","url":"git://github.com/tkellen/expander.git"},"bugs":{"url":"https://github.com/tkellen/expander/issues"},"licenses":[{"type":"MIT","url":"https://github.com/tkellen/expander/blob/master/LICENSE-MIT"}],"main":"index.js","engines":{"node":">= 0.8.0"},"scripts":{"test":"mocha -R spec test/index.js"},"devDependencies":{"mocha":"~1.17.1","chai":"~1.9.0"},"keywords":["declarative configuration"],"dependencies":{"getobject":"0.1.0","lodash":"~2.2.1"},"_id":"expander@0.3.0","dist":{"shasum":"cb6fb0045f9460abdc9e6464e1832a0f71ad3023","size":3178,"noattachment":false,"key":"/expander/-/expander-0.3.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/expander/download/expander-0.3.0.tgz"},"_from":".","_npmVersion":"1.3.26","_npmUser":{"name":"tkellen","email":"tyler@sleekcode.net"},"maintainers":[{"name":"tkellen","email":"tyler@sleekcode.net"}],"directories":{},"publish_time":1392050786535,"_cnpm_publish_time":1392050786535,"_hasShrinkwrap":false},"0.2.2":{"name":"expander","description":"Expand template strings in declarative configurations.","version":"0.2.2","homepage":"https://github.com/tkellen/expander","author":{"name":"Tyler Kellen","url":"http://goingslowly.com/"},"repository":{"type":"git","url":"git://github.com/tkellen/expander.git"},"bugs":{"url":"https://github.com/tkellen/expander/issues"},"licenses":[{"type":"MIT","url":"https://github.com/tkellen/expander/blob/master/LICENSE-MIT"}],"main":"lib/expander","engines":{"node":">= 0.8.0"},"scripts":{"test":"grunt"},"devDependencies":{"grunt-contrib-jshint":"~0.7.1","grunt-contrib-nodeunit":"~0.2.2","grunt":"~0.4.1"},"keywords":["declarative configuration"],"dependencies":{"getobject":"0.1.0","lodash":"~2.2.1"},"readmeFilename":"README.md","_id":"expander@0.2.2","dist":{"shasum":"1bbbaf491b7955922a18514b704069fc5673e018","size":2974,"noattachment":false,"key":"/expander/-/expander-0.2.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/expander/download/expander-0.2.2.tgz"},"_from":".","_npmVersion":"1.3.14","_npmUser":{"name":"tkellen","email":"tyler@sleekcode.net"},"maintainers":[{"name":"tkellen","email":"tyler@sleekcode.net"}],"directories":{},"publish_time":1387132293170,"_cnpm_publish_time":1387132293170,"_hasShrinkwrap":false},"0.2.1":{"name":"expander","description":"Expand template strings in declarative configurations.","version":"0.2.1","homepage":"https://github.com/tkellen/expander","author":{"name":"Tyler Kellen","url":"http://goingslowly.com/"},"repository":{"type":"git","url":"git://github.com/tkellen/expander.git"},"bugs":{"url":"https://github.com/tkellen/expander/issues"},"licenses":[{"type":"MIT","url":"https://github.com/tkellen/expander/blob/master/LICENSE-MIT"}],"main":"lib/expander","engines":{"node":">= 0.8.0"},"scripts":{"test":"grunt"},"devDependencies":{"grunt-contrib-jshint":"~0.7.1","grunt-contrib-nodeunit":"~0.2.2","grunt":"~0.4.1"},"keywords":["declarative configuration"],"dependencies":{"getobject":"0.1.0","lodash":"~2.2.1"},"readmeFilename":"README.md","_id":"expander@0.2.1","dist":{"shasum":"61c89119494f0b0858bd7c470209ac82f9394129","size":2873,"noattachment":false,"key":"/expander/-/expander-0.2.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/expander/download/expander-0.2.1.tgz"},"_from":".","_npmVersion":"1.3.11","_npmUser":{"name":"tkellen","email":"tyler@sleekcode.net"},"maintainers":[{"name":"tkellen","email":"tyler@sleekcode.net"}],"directories":{},"publish_time":1385065023639,"_cnpm_publish_time":1385065023639,"_hasShrinkwrap":false},"0.2.0":{"name":"expander","description":"Expand template strings in declarative configurations.","version":"0.2.0","homepage":"https://github.com/tkellen/expander","author":{"name":"Tyler Kellen","url":"http://goingslowly.com/"},"repository":{"type":"git","url":"git://github.com/tkellen/expander.git"},"bugs":{"url":"https://github.com/tkellen/expander/issues"},"licenses":[{"type":"MIT","url":"https://github.com/tkellen/expander/blob/master/LICENSE-MIT"}],"main":"lib/expander","engines":{"node":">= 0.8.0"},"scripts":{"test":"grunt"},"devDependencies":{"grunt-contrib-jshint":"~0.7.1","grunt-contrib-nodeunit":"~0.2.2","grunt":"~0.4.1"},"keywords":["declarative configuration"],"dependencies":{"dotty":"0.0.2","lodash":"~2.2.1"},"readmeFilename":"README.md","_id":"expander@0.2.0","dist":{"shasum":"56d3ecdb3e9c8b0fd36a3a602a55bcf069186997","size":2731,"noattachment":false,"key":"/expander/-/expander-0.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/expander/download/expander-0.2.0.tgz"},"_from":".","_npmVersion":"1.3.11","_npmUser":{"name":"tkellen","email":"tyler@sleekcode.net"},"maintainers":[{"name":"tkellen","email":"tyler@sleekcode.net"}],"directories":{},"publish_time":1383929645234,"_cnpm_publish_time":1383929645234,"_hasShrinkwrap":false},"0.1.0":{"name":"expander","description":"Expand template strings in declarative configurations.","version":"0.1.0","homepage":"https://github.com/tkellen/expander","author":{"name":"Tyler Kellen","url":"http://goingslowly.com/"},"repository":{"type":"git","url":"git://github.com/tkellen/expander.git"},"bugs":{"url":"https://github.com/tkellen/expander/issues"},"licenses":[{"type":"MIT","url":"https://github.com/tkellen/expander/blob/master/LICENSE-MIT"}],"main":"lib/expander","engines":{"node":">= 0.8.0"},"scripts":{"test":"grunt"},"devDependencies":{"grunt-contrib-jshint":"~0.7.1","grunt-contrib-nodeunit":"~0.2.2","grunt":"~0.4.1"},"keywords":["declarative configuration"],"dependencies":{"dotty":"0.0.2","lodash":"~2.2.1"},"readmeFilename":"README.md","_id":"expander@0.1.0","dist":{"shasum":"a938d784dbc60916106d517cd78adb6f1b8b0792","size":2669,"noattachment":false,"key":"/expander/-/expander-0.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/expander/download/expander-0.1.0.tgz"},"_from":".","_npmVersion":"1.3.11","_npmUser":{"name":"tkellen","email":"tyler@sleekcode.net"},"maintainers":[{"name":"tkellen","email":"tyler@sleekcode.net"}],"directories":{},"publish_time":1383715866027,"_cnpm_publish_time":1383715866027,"_hasShrinkwrap":false}},"readme":"# expander [![Build Status](https://secure.travis-ci.org/tkellen/node-expander.png?branch=master)](http://travis-ci.org/tkellen/node-expander)\n\n> Expand template strings in declarative configurations.\n\n## API\n\n### get(data, lookup, imports)\nRetrieve a value from the data object with all template strings resolved.\n\n`data` a configuration object\n`lookup` a dot-notated key\n`options` sent to [_.template](http://lodash.com/docs#template) when resolving values.\n\nExample:\n```js\nvar data = {\n  key: '<%= uppercase(\"foo\") %>'\n};\nexpander.get(data, 'key', {\n  imports: {\n    uppercase: function (str) {\n      return str.toUpperCase();\n    }\n  }\n}); // FOO\n```\n\n### getRaw(data, lookup)\nRetrieve a literal value from the data object.\n\n`data` a configuration object\n`lookup` a dot-notated string representing a key in the configuration\n\n### set(data, lookup, value)\nSet a value in the data object.\n\n`data` a configuration object\n`lookup` a dot-notated string representing a key in the data\n`value` the value to set\n\n### process(data, lookup, options)\nResolve any arbitrary template string.\n\n`data` a configuration object\n`lookup` any string value, typically a template string, e.g. \"<%= key %>\"\n`options` sent to [_.template](http://lodash.com/docs#template) when resolving values.\n\n### interface(data, options)\nBind the above API to a provided data object so you can access it more succinctly.\n\n`data` a configuration object\n`options` sent to [_.template](http://lodash.com/docs#template) automatically when resolving values.\n\n**Note:** When using the interface API, passing options to `get` or `process` will perform a shallow merge over `options` provided when the interface was instantiated.\n\nExample:\n```js\nvar configRaw = {\n  key: 'value',\n  keyRef: '<%= key %>'\n};\nvar config = expander.interface(config);\nconfig('key'); // value\nconfig.get('key'); // value\nconfig('keyRef'); // value\nconfig.get('keyRef'); // value\nconfig('key', 'changed'); // changed\nconfig('key'); // changed\n```\n\n## Examples\n\n```js\nvar expander = require('expander');\n\nvar data = {\n  key: 'value',\n  keyRef: '<%= key %>',\n  recursiveKeyRef: '<%= keyRef %>',\n  arrayRef: ['test', '<%= key %>'],\n  recursiveArrayRef: ['test', '<%= arrayRef %>'],\n  obj: {\n    keyRef: '<%= key %>',\n    recursiveKeyRef: '<%= keyRef %>',\n    arrayRef: ['test', '<%= key %>'],\n    recursiveArrayRef: ['test', '<%= arrayRef %>']\n  },\n  dotRef: '<%= obj.keyRef %>',\n  objRef: '<%= obj %>',\n  interpolated: 'test <%= key %>',\n  interpolatedRecursiveRef: 'test <%= keyRef %>',\n  methodRef: expander.fn(function (config) {\n    // config is the entire config\n    return config.key;\n  }),\n  methodRefContext: expander.fn(function (config) {\n    // this is a reference to expander\n    return this.get(config, 'keyRef');\n  })\n};\n\nexpander.get(data, 'keyRef'); // value\nexpander.get(data, 'recursiveKeyRef'); // value\nexpander.get(data, 'arrayRef'); // ['test', 'value']\nexpander.get(data, 'recursiveArrayRef'); // ['test', ['test', 'value']]\nexpander.get(data, 'obj'); // {\n                           //   keyRef: 'value',\n                           //   recursiveKeyRef: 'value',\n                           //   arrayRef: ['test', 'value'],\n                           //   recursiveArrayRef: ['test', ['test', 'value']]\n                           // }\nexpander.get(data, 'objRef'); // {\n                              //   keyRef: 'value',\n                              //   recursiveKeyRef: 'value',\n                              //   arrayRef: ['test', 'value'],\n                              //   recursiveArrayRef: ['test', ['test', 'value']]\n                              // }\nexpander.get(data, 'interpolated'); // test value\nexpander.get(data, 'interpolatedRecursiveRef'); // test value\nexpander.get(data, 'methodRef'); // value\nexpander.get(data, 'methodRefContext'); // value\n\n// getter setter api\nvar config = expander.interface(data);\nconfig('keyRef'); // value\nconfig('recursiveKeyRef'); // value\nconfig('arrayRef'); // ['test', 'value']\nconfig('recursiveArrayRef'); // ['test', ['test', 'value']]\nconfig('obj'); // {\n               //   keyRef: 'value',\n               //   recursiveKeyRef: 'value',\n               //   arrayRef: ['test', 'value'],\n               //   recursiveArrayRef: ['test', ['test', 'value']]\n               // }\nconfig('objRef'); // {\n                  //   keyRef: 'value',\n                  //   recursiveKeyRef: 'value',\n                  //   arrayRef: ['test', 'value'],\n                  //   recursiveArrayRef: ['test', ['test', 'value']]\n                  // }\nconfig('interpolated'); // test value\nconfig('interpolatedRecursiveRef'); // test value\nconfig('methodRef'); // value\nconfig('methodRefContext'); // value\n```\n\n## Release History\n\n* 2014-02-21 - v0.3.3 - allow overriding default options for _.template in interface api\n* 2014-02-20 - v0.3.2 - allow passing options to _.template\n* 2014-02-11 - v0.3.1 - interface emits events on set\n* 2014-02-10 - v0.3.0 - support a getter/setter api\n* 2013-12-15 - v0.2.2 - support auto expansion of functions\n* 2013-11-21 - v0.2.1 - support ${value} strings\n* 2013-11-08 - v0.2.0 - correctly handle recursively interpolated values\n* 2013-11-05 - v0.1.0 - initial release\n","_attachments":{},"homepage":"https://github.com/tkellen/expander","bugs":{"url":"https://github.com/tkellen/expander/issues"}}