Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
doowb committed Nov 13, 2019
1 parent e873a4f commit 3cc9a4b
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,9 @@ class Store {
*/

get(key, fallback) {
if (typeof key === 'undefined') return this.data;
if (typeof key === 'undefined') {
return this.data;
}
assert.equal(typeof key, 'string', 'expected key to be a string');
const value = get(this.data, key);
if (typeof value === 'undefined') {
Expand Down Expand Up @@ -253,7 +255,9 @@ class Store {

del(key) {
if (Array.isArray(key)) {
for (const k of key) this.del(k);
for (const k of key) {
this.del(k);
}
return this;
}

Expand Down Expand Up @@ -343,8 +347,12 @@ class Store {
*/

save() {
if (!this.debounce) return this.writeFile();
if (this.timeouts.save) clearTimeout(this.timeouts.save);
if (!this.debounce) {
return this.writeFile();
}
if (this.timeouts.save) {
clearTimeout(this.timeouts.save);
}
this.timeouts.save = setTimeout(this.writeFile.bind(this), this.debounce);
}

Expand Down

0 comments on commit 3cc9a4b

Please sign in to comment.