dirty-store
Advanced tools
Comparing version 0.0.1 to 0.0.3
@@ -30,2 +30,4 @@ /** | ||
*/ | ||
var util = require('util'); | ||
var store = { | ||
@@ -63,3 +65,3 @@ // Initialise the store. | ||
// Only store primitive types | ||
if (typeof val === "object") return this; | ||
if (typeof val === "object" && !util.isArray(val)) return this; | ||
// Regular set | ||
@@ -81,2 +83,3 @@ this._[id] = val; | ||
return Object.keys(this._).reduce(function (memo, key) { | ||
if (typeof this._[key] === "undefined") return memo; | ||
memo[key] = (this._[key].toObject ? this._[key].toObject() : this._[key]); | ||
@@ -83,0 +86,0 @@ return memo; |
{ | ||
"name": "dirty-store", | ||
"version": "0.0.1", | ||
"version": "0.0.3", | ||
"description": "A quick and dirty, nestable store that converts well to a native JS object.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -5,2 +5,6 @@ # dirty-store | ||
```shell | ||
npm install dirty-store | ||
``` | ||
## example | ||
@@ -7,0 +11,0 @@ |
@@ -28,2 +28,11 @@ var t = require('tap'); | ||
t.test('set array', function (t) { | ||
st.set('d', [1, 2, 3]); | ||
t.ok(st._.d, 'd is set'); | ||
t.equal(st._.d[0], 1, 'd has the correct value'); | ||
t.equal(st._.d[1], 2, 'd has the correct value'); | ||
t.equal(st._.d[2], 3, 'd has the correct value'); | ||
t.end(); | ||
}); | ||
}); | ||
@@ -30,0 +39,0 @@ |
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
7969
240
100