Open Nathan-Schwartz opened 7 years ago
@Nathan-Schwartz @dthree
I feel like this entire file can be removed. It's almost a 1:1 map of the native LocalStorage
, with the addition of validate()
. We can easily move all this logic into Vorpal#localStorage
.
For example, this is the current code:
vorpal.localStorage = function (id) {
var ls = Object.create(LocalStorage);
ls.setId(id);
_.extend(this.localStorage, ls);
return this;
};
Which can be changed to:
vorpal.localStorage = function (id) {
if (!id) {
throw new Error('vorpal.localStorage() requires a unique key to be passed in.');
}
Object.assign(this.localStorage, new LocalStorage(DEFAULT_STORAGE_PATH + id));
return this;
};
I haven't tested it yet, but worth a shot.
Agreed. Go for it.
Sounds good to me. Seems like we can close this.
@milesj Would you like to take a crack at reusing Vorpal#localStorage
? Not sure what kind of time I'll have in the near future.
Yeah I can take a look at it. I'll leave this PR open in case it doesn't work.
Tests and linter pass. Runs in Node without babel.