Use bower.json as a config store.
npm install bower-store> Use bower.json as a config store.
Install with npm:
``sh`
$ npm install bower-store --save
Inherits cache-base, please see the cache-base documentation for more details.
Pass the cwd and options to use, or an options object with cwd or path. If nothing is passed, the current working directory will be used.
`js`
var bower = require('bower-store')(cwd, options);
// or
var bower = require('bower-store')(options);
// or
var bower = require('bower-store')();
Example
`js`
var bower = require('bower-store')(process.cwd());
Inherits cache-base, please see the cache-base documentation for more details.
`js`
bower.set(key, value);
Set property key with the given value.
Example
`js
bower.set('name', 'my-project');
console.log(bower.data);
//=> {"name": "my-project"}
console.log(bower.get('name'));
//=> "my-project"
`
Persist bower.json to the file system at bower.path.
`js`
bower.set('name', 'my-project');
bower.save();
`js`
bower.get(key);
Get property key from bower.json.
Example
`js
// given {"name": "my-project"}
bower.set('bin.foo', 'bar');
console.log(bower.get('bin'));
//=> {"foo": "bar"}
`
`js`
bower.has(key);
Returns true if bower.json has property key.
Example
`js`
// given: {"name": "my-project"}
console.log(bower.has('name'));
//=> true
console.log(bower.has('zzzzzzz'));
//=> false
`js`
bower.union(key, val);
Create array key, or concatenate values to array key. Also uniquifies the array.
Example
`js
bower.union('keywords', 'foo');
bower.union('keywords', ['bar', 'baz']);
console.log(bower.get('keywords'));
//=> ['foo', 'bar', 'baz']
console.log(bower.data);
//=> {keywords: ['foo', 'bar', 'baz']}
`
Delete the bower.json file at bower.path.
Example
`js`
bower.rm();
You might also be interested in these projects:
* data-store: Easily get, set and persist config data. | homepage
* expand-pkg: Parse string values in package.json into objects. | homepage
* find-pkg: Find the first directory with a package.json, recursing up, starting with the given directory. Similar… more | homepage
* normalize-pkg: Normalize values in package.json using the map-schema library. | homepage
* pkg-store: Use package.json as a config store. | homepage
* sync-pkg: CLI to sync only basic properties from package.json to bower.json. | homepage
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
Generate readme and API documentation with verb:
`sh`
$ npm install verb && npm run docs
Or, if verb is installed globally:
`sh`
$ verb
Install dev dependencies:
`sh``
$ npm install -d && npm test
Jon Schlinkert
Follow me on GitHub or Twitter for updates about bower-store and my other libraries:
* github/jonschlinkert
* twitter/jonschlinkert
Copyright © 2016, Jon Schlinkert.
Released under the MIT license.
*
_This file was generated by verb, v, on April 07, 2016._