data-store
Advanced tools
Comparing version 0.15.0 to 0.15.1
17
index.js
@@ -68,4 +68,4 @@ 'use strict'; | ||
this.name = name || utils.project(); | ||
this.cwd = utils.resolve(this.options.cwd || '~/data-store'); | ||
this.path = path.resolve(this.cwd, this.name + '.json'); | ||
this.cwd = utils.resolve(this.options.cwd || '~/.data-store'); | ||
this.path = path.resolve(this.cwd, this.name, 'data.json'); | ||
this.data = readFile(this.path); | ||
@@ -97,8 +97,5 @@ this.define('cache', utils.clone(this.data)); | ||
utils.validateName(this, name); | ||
var opts = utils.extend({}, options); | ||
var substore = new Store(name); | ||
var base = path.dirname(this.path); | ||
opts.cwd = path.join(base, name); | ||
var substore = new Store(name, opts); | ||
substore.path = path.join(base, 'substores', name + '.json'); | ||
this[name] = substore; | ||
@@ -318,4 +315,6 @@ return substore; | ||
utils.define(Store.prototype, 'keys', { | ||
set: function() { | ||
throw new Error('store.keys is a getter and cannot be set'); | ||
configurable: true, | ||
enumerable: true, | ||
set: function(keys) { | ||
utils.define(this, 'keys', keys); | ||
}, | ||
@@ -322,0 +321,0 @@ get: function fn() { |
{ | ||
"name": "data-store", | ||
"description": "Easily get, set and persist config data.", | ||
"version": "0.15.0", | ||
"version": "0.15.1", | ||
"homepage": "https://github.com/jonschlinkert/data-store", | ||
@@ -6,0 +6,0 @@ "author": "Jon Schlinkert (https://github.com/jonschlinkert)", |
@@ -90,3 +90,3 @@ # data-store [![NPM version](https://img.shields.io/npm/v/data-store.svg)](https://www.npmjs.com/package/data-store) [![Build Status](https://img.shields.io/travis/jonschlinkert/data-store.svg)](https://travis-ci.org/jonschlinkert/data-store) | ||
### [.set](index.js#L136) | ||
### [.set](index.js#L133) | ||
@@ -123,3 +123,3 @@ Assign `value` to `key` and save to disk. Can be a key-value pair or an object. | ||
### [.union](index.js#L152) | ||
### [.union](index.js#L149) | ||
@@ -143,3 +143,3 @@ Add or append an array of unique values to the given `key`. | ||
### [.get](index.js#L178) | ||
### [.get](index.js#L175) | ||
@@ -164,3 +164,3 @@ Get the stored `value` of `key`, or return the entire store if no `key` is defined. | ||
### [.has](index.js#L194) | ||
### [.has](index.js#L191) | ||
@@ -184,3 +184,3 @@ Returns `true` if the specified `key` has truthy value. | ||
### [.hasOwn](index.js#L215) | ||
### [.hasOwn](index.js#L212) | ||
@@ -209,3 +209,3 @@ Returns `true` if the specified `key` exists. | ||
### [.save](index.js#L236) | ||
### [.save](index.js#L233) | ||
@@ -224,3 +224,3 @@ Persist the store to disk. | ||
### [.clear](index.js#L251) | ||
### [.clear](index.js#L248) | ||
@@ -235,3 +235,3 @@ Clear in-memory store cache. | ||
### [.del](index.js#L276) | ||
### [.del](index.js#L273) | ||
@@ -256,3 +256,3 @@ Delete `keys` from the store, or delete the entire store if no keys are passed. A `del` event is also emitted for each key deleted. | ||
### [.define](index.js#L336) | ||
### [.define](index.js#L335) | ||
@@ -259,0 +259,0 @@ Define a non-enumerable property on the instance. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
19950
393