{"_id":"namespace-data","_rev":"80310","name":"namespace-data","description":"Read data files and extend the data from each onto an object or objects named using the given string or [propstring].","dist-tags":{"latest":"0.1.0"},"maintainers":[{"name":"jonschlinkert","email":"github@sellside.com"}],"time":{"modified":"2021-06-03T10:25:40.000Z","created":"2014-07-19T04:30:31.833Z","0.1.0":"2014-07-19T04:30:31.833Z"},"users":{},"author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"repository":{"type":"git","url":"git://github.com/jonschlinkert/namespace-data.git"},"versions":{"0.1.0":{"name":"namespace-data","description":"Read data files and extend the data from each onto an object or objects named using the given string or [propstring].","version":"0.1.0","homepage":"https://github.com/jonschlinkert/namespace-data","author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"repository":{"type":"git","url":"git://github.com/jonschlinkert/namespace-data.git"},"bugs":{"url":"https://github.com/jonschlinkert/namespace-data/issues"},"licenses":[{"type":"MIT","url":"https://github.com/jonschlinkert/namespace-data/blob/master/LICENSE-MIT"}],"keywords":["array","basename","data","dir","dirname","ext","extname","file","filepath","files","name","namespace","node","node.js","object","parse","path","properties","property","read"],"main":"index.js","engines":{"node":">=0.10.0"},"scripts":{"test":"mocha -R spec"},"devDependencies":{"mocha":"*","should":"^4.0.4","verb":">= 0.2.6","verb-tag-jscomments":">= 0.1.4"},"dependencies":{"arrayify-compact":"^0.1.0","globby":"^0.1.1","lodash":"^2.4.1","parse-filepath":"^0.3.0","read-data":"^0.1.1","replacements":"^0.1.3"},"_id":"namespace-data@0.1.0","_shasum":"d1087ebfc3bbc338c2e6c0f586f048069bcbc940","_from":".","_npmVersion":"1.4.9","_npmUser":{"name":"jonschlinkert","email":"github@sellside.com"},"maintainers":[{"name":"jonschlinkert","email":"github@sellside.com"}],"dist":{"shasum":"d1087ebfc3bbc338c2e6c0f586f048069bcbc940","size":4217,"noattachment":false,"key":"/namespace-data/-/namespace-data-0.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/namespace-data/download/namespace-data-0.1.0.tgz"},"directories":{},"publish_time":1405744231833,"_cnpm_publish_time":1405744231833,"_hasShrinkwrap":false}},"readme":"# namespace-data [![NPM version](https://badge.fury.io/js/namespace-data.png)](http://badge.fury.io/js/namespace-data)\n\n> Read data files and extend the data from each onto an object or objects named using the given string or [propstring].\n\n## Install\nInstall with [npm](npmjs.org):\n\n```bash\nnpm i namespace-data --save-dev\n```\n\n## Usage\n\n```js\nvar namespace = require('namespace-data');\nconsole.log(namespace(':basename', 'package.json'));\n//=> {\"package\": {\"name\": \"namespace-data\", \"version\": \"0.1.0\" ...}}\n```\n\n## API\n```js\nnamespace(':propstring', [glob], {context: {}});\n```\n  - `:propstring` A variable, like a template, which will be replaced with the\n    value of any matching property on the context. You can use any prop strings that\n    match properties on the context. The default context consists of all the method\n    names from the [node.js path module][node.js], (e.g. `:basename`, `:extname`, etc.)\n  - `glob`: File path, paths or glob patterns for data files to read.\n  - `context`: Extend the context to enable additional values to be used as propstrings.\n\nRead data files and extend the data from each onto an object or objects named using\nthe given string or propstring.\n\n#### Examples\n\nGiven you have two JSON files, `a.json` and `b.json`, with the following contents:\n\n```json\n// a.json\n{\n  \"foo\": \"I'm a.json!\"\n}\n\n// b.json\n{\n  \"bar\": \"I'm b.json!\"\n}\n```\n\n**propstrings**\n\nYou can namespace the data from each file onto an object where the object name is\ndynamically generated using `:propstrings`.\n\n```js\ndata.namespace(':basename', ['a.json', 'b.json']);\n//=> '{ \"a\": {\"foo\": \"I'm a.json!\"}, \"b\": {\"bar\": \"I'm b.json!\"} }'\n\n// if a single argument is passed, `basename` is used by default, so this:\ndata.namespace(['a.json', 'b.json']);\n// also results in '{ \"a\": {\"foo\": \"I'm a.json!\"}, \"b\": {\"bar\": \"I'm b.json!\"} }'\n```\n\nSame data but namespaced using `:ext` (file extension) instead:\n\n```js\ndata.namespace(':ext', ['a.json', 'b.json']);\n{ \"json\": {\"foo\": \"I'm a.json!\", \"bar\": \"I'm b.json!\"} }\n```\n\n\n[node.js]: http://nodejs.org/api/path.html\n\n* `patterns` {*}: Filepaths or glob patterns.  \n* `return` {null}\n\n## Author\n\n**Jon Schlinkert**\n \n+ [github/jonschlinkert](https://github.com/jonschlinkert)\n+ [twitter/jonschlinkert](http://twitter.com/jonschlinkert) \n\n## License\nCopyright (c) 2014 Jon Schlinkert, contributors.  \nReleased under the MIT license\n\n***\n\n_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on July 19, 2014._","_attachments":{},"homepage":"https://github.com/jonschlinkert/namespace-data","bugs":{"url":"https://github.com/jonschlinkert/namespace-data/issues"}}