{"name":"plasma-cache","description":"Object cache for plasma.","version":"0.1.0","homepage":"https://github.com/jonschlinkert/plasma-cache","author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"repository":{"type":"git","url":"https://github.com/jonschlinkert/plasma-cache"},"bugs":{"url":"https://github.com/jonschlinkert/plasma-cache/issues"},"license":"MIT","files":["index.js"],"main":"index.js","engines":{"node":">=0.10.0"},"scripts":{"test":"mocha"},"dependencies":{"expander":"^0.3.3","extend-shallow":"^1.1.4","filter-functions":"^0.1.0","kind-of":"^1.1.0","object.omit":"^1.1.0","plasma":"^0.8.2"},"devDependencies":{"mocha":"*","should":"*"},"keywords":[],"_id":"plasma-cache@0.1.0","_shasum":"461b7078d3b35f06cc4a31bfd9f6ab96f99ba1b9","_from":".","_npmVersion":"2.5.1","_nodeVersion":"0.12.0","_npmUser":{"name":"jonschlinkert","email":"github@sellside.com"},"maintainers":[{"name":"jonschlinkert","email":"github@sellside.com"}],"dist":{"shasum":"461b7078d3b35f06cc4a31bfd9f6ab96f99ba1b9","tarball":"http://registry-npm.ywwl.com/plasma-cache/download/plasma-cache-0.1.0.tgz","integrity":"sha512-9G+ET5MIHY9ApIz2tSq+dL80hRz79hV4w6ltnOtUewTayUjHtK6rqSzLld+Qy8p86Q1lWD5j11KtGXHshf6GZA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBrRqVQ5o1Y28/L6DTXlh0j434kXaI+U2h9DvXMWWGV+AiEAsTlFX1PDr1WJID1/PLTQ5K7xWS4PaB3C2aMTTPtb6+Y="}],"size":3456,"noattachment":false,"key":"/plasma-cache/-/plasma-cache-0.1.0.tgz"},"directories":{},"readme":"# plasma-cache [![NPM version](https://badge.fury.io/js/plasma-cache.svg)](http://badge.fury.io/js/plasma-cache)\n\n> Object cache for [Plasma](https://github.com/jonschlinkert/plasma).\n\n## Install\n\nInstall with [npm](https://www.npmjs.com/)\n\n```sh\n$ npm i plasma-cache --save\n```\n\nInstall with [bower](http://bower.io/)\n\n```sh\n$ bower install plasma-cache --save\n```\n\n## Usage\n\n```js\nvar PlasmaCache = require('plasma-cache');\nvar cache = new PlasmaCache();\n```\n\n## API\n\n### [PlasmaCache](index.js#L23)\n\nInitialize a new `PlasmaCache`.\n\n### [.plasma](index.js#L58)\n\nExtend the `data` object with the value returned by [plasma](https://github.com/jonschlinkert/plasma).\n\nSee the [plasma](https://github.com/jonschlinkert/plasma) documentation for all available options.\n\n**Params**\n\n* `data` **{Object|String|Array}**: File path(s), glob pattern, or object of data.\n* `options` **{Object}**: Options to pass to plasma.\n\n**Example**\n\n```js\ncache\n  .plasma({foo: 'bar'}, {baz: 'quux'});\n  .plasma({fez: 'bang'});\n```\n\n### [.dataLoader](index.js#L82)\n\nRegister a `dataLoader` that will read and load data from files with the given `ext`.\n\n**Params**\n\n* `ext` **{String}**: The extension of files to read.\n* `fn` **{String}**: The loader function\n\n**Example**\n\n```js\nvar fs = require('fs');\nvar yaml = require('js-yaml');\n\nplasma.dataLoader('yml', function (fp) {\n  var str = fs.readFileSync(fp, 'utf8');\n  return yaml.safeLoad(str);\n});\n```\n\n### [.process](index.js#L96)\n\nUse [expander](https://github.com/tkellen/expander) to recursively expand template strings into\ntheir resolved values.\n\n**Params**\n\n* `lookup` **{*}**: Any value to process, usually strings with a cache template, like `<%= foo %>` or `${foo}`.\n* `opts` **{*}**: Options to pass to Lo-Dash `  _.template`.\n\n**Example**\n\n```js\ncache.process({a: '<%= b %>', b: 'c'});\n//=> {a: 'c', b: 'c'}\n```\n\n### [.flattenData](index.js#L122)\n\nIf a `data` property is on the given `data` object\n(e.g. `data.data`, like when files named `data.json`\nor `data.yml` are used), `data.data` is flattened to\njust `data`\n\n**Params**\n\n* `data` **{Object}**\n* `returns` **{Object}**: Flattened object.\n\n### [.extendData](index.js#L136)\n\nExtend the `cache.data` object with the given data. This\nmethod is chainable.\n\n* `returns` **{Object}** `PlasmaCache`: to enable chaining\n\n**Example**\n\n```js\ncache\n  .extendData({foo: 'bar'}, {baz: 'quux'});\n  .extendData({fez: 'bang'});\n```\n\n### [.data](index.js#L165)\n\nExtend the `cache.data` object with data from a JSON\nor YAML file, or by passing an object directly - glob\npatterns or file paths may be used.\n\n**Params**\n* `values` **{Object|Array|String}**: Values to pass to plasma.\n* `process` **{Boolean}**: If `true` is passed as the last argumemnt data will\n* `returns` **{Object}** `PlasmaCache`: to enable chaining\n\n**Example**\n\n```js\ncache\n  .data({a: 'b'})\n  .data({c: 'd'});\n\nconsole.log(cache);\n//=> {data: {a: 'b', c: 'd'}}\n\ncache.data('*.{json,yml}');\n// or\ncache.data('package.json');\n//=> {name: 'plasma-cache', ...}\n\n// process config templates\ncache.data({a: '<%= b %>', b: 'z'})\n//=> {data: {a: 'z', b: 'z'}}\n```\n\n## Related projects\n\n* [config-cache](https://github.com/jonschlinkert/config-cache): General purpose JavaScript object storage methods.\n* [data-store](https://github.com/jonschlinkert/data-store): Easily get, set and persist config data.\n* [option-cache](https://github.com/jonschlinkert/option-cache): Simple API for managing options in JavaScript applications.\n* [plasma](https://github.com/jonschlinkert/plasma): Load data from globs or files or directly from objects.\n\n## Running tests\n\nInstall dev dependencies:\n\n```sh\n$ npm i -d && npm test\n```\n\n## Contributing\n\nPull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/plasma-cache/issues/new)\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\n\nCopyright © 2015 [Jon Schlinkert](https://github.com/jonschlinkert)\nReleased under the MIT license.\n\n***\n\n_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on June 01, 2015._\n","publish_time":1432975978761,"_cnpm_publish_time":1432975978761,"dist-tags":{"latest":"0.2.2"}}