0.1.0 • Published 8 years ago

bower-store v0.1.0

Weekly downloads
14
License
MIT
Repository
github
Last release
8 years ago

bower-store NPM version NPM downloads Build Status

Use bower.json as a config store.

Install

Install with npm:

$ npm install bower-store --save

Inherits cache-base, please see the cache-base documentation for more details.

Usage

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.

var bower = require('bower-store')(cwd, options);
// or
var bower = require('bower-store')(options);
// or
var bower = require('bower-store')();

Example

var bower = require('bower-store')(process.cwd());

API

Inherits cache-base, please see the cache-base documentation for more details.

.set

bower.set(key, value);

Set property key with the given value.

Example

bower.set('name', 'my-project');

console.log(bower.data);
//=> {"name": "my-project"}

console.log(bower.get('name'));
//=> "my-project"

.save

Persist bower.json to the file system at bower.path.

bower.set('name', 'my-project');
bower.save();

.get

bower.get(key);

Get property key from bower.json.

Example

// given {"name": "my-project"}
bower.set('bin.foo', 'bar');

console.log(bower.get('bin'));
//=> {"foo": "bar"}

.has

bower.has(key);

Returns true if bower.json has property key.

Example

// given: {"name": "my-project"}
console.log(bower.has('name'));
//=> true
console.log(bower.has('zzzzzzz'));
//=> false

.union

bower.union(key, val);

Create array key, or concatenate values to array key. Also uniquifies the array.

Example

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']}

.rm

Delete the bower.json file at bower.path.

Example

bower.rm();

Related projects

You might also be interested in these projects:

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.

Building docs

Generate readme and API documentation with verb:

$ npm install verb && npm run docs

Or, if verb is installed globally:

$ verb

Running tests

Install dev dependencies:

$ npm install -d && npm test

Author

Jon Schlinkert

Follow me on GitHub or Twitter for updates about bower-store and my other libraries:

License

Copyright © 2016, Jon Schlinkert. Released under the MIT license.


This file was generated by verb, v, on April 07, 2016.