-
-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow append to existing object; allow user-provided read/write functions #29
Conversation
…ions The following changes are included here: 1. New Method: append A new `append` method has been added. Whereas the traditional calls such as ``` store.set('a', { b : c }); store.set('a', { d : e }); ``` allows the second call to overwrite the entire value of 'a', yielding ``` { d : e } ``` this sequence: ``` store.append('a', { b : c }); store.append('a', { d : e }); ``` ratains prior values, and thus yields: ``` { b : c, d : e } ``` 2. The means of reading (and parsing), and writing to files can now be overridden by the caller, in the `options` argument. This allows adding additional error handling, in the simple case, or reading and writing entirely different types of files in the more sophisticated case. An example is provided in `examples/ini.js` that shows the store reading and writing an INI file, while allowing it to be manipulated programmatically in the standard data-store fashion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR. Depending on @jonschlinkert feedback, I like this idea. I'm requesting a few changes and have a few questions in this review. Also, please add tests for the new options.
I don't know mocha well enough (or at all, other than by inspection of existing tests) to be able to add tests for the new options. That requires not doing the Otherwise, I think all questions have been answered and addressed. Hope you find this good to go. Thanks. |
@derrell thanks for the making the requested changes. I'll look at this over the weekend and try it out using the example code. |
A friendly ping... |
Sorry, I didn't get to this last weekend. I'll check it out this weekend. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@derrell sorry for the delay in getting to this. All of the changes I'm requesting here are linting changes to keep with the same syntax style of the project. Most of them I was able to use the "suggest" feature on GitHub, but there are a couple of multi-line changes that I wasn't able to use that.
Thanks again, and I think this looks good after those nitpicks. I did pull this down to run the example and tests.
You got it! Yes, I always try to maintain style consistency with whatever code I'm editing, but habits are... well, they're habitual. :-) All should be corrected now. |
@derrell thanks, there are a still a few places with requested changes. (BTW... I made them granular because GitHub makes it easy to do single line "suggestions" and to resolve "outdated" conversations) |
Sigh. Github covered those up with a "hidden conversations" that I didn't notice. I think all are now showing as outdated, so hopefully we're all set. |
Thanks! Sorry for all the nitpicks, I'm going to merge this in and I'll get the version bumped and published today or tomorrow morning. |
Thanks! |
Hi. I've been using the source version to date, so hadn't noticed... It seems that the new version never got published? |
@doowb Just a ping to see if you wanted to publish this latest version now that you've been given permission... Thanks. |
@derrell I had realized that the I'll be merging that PR in soon and publishing it to npm. There were also a few naming changes with the new options that you introduced. Thanks for your original PR and sorry for the delay in getting it published. |
Thanks. Eagerly awaiting. It looks like examples/ini.js will need an update to the new naming scheme as well; it uses the names I had added. |
The following changes are included here:
A new
append
method has been added. Whereas the traditional calls such asallows the second call to overwrite the entire value of 'a', yielding
this sequence:
ratains prior values, and thus yields:
overridden by the caller, in the
options
argument. This allows addingadditional error handling, in the simple case, or reading and writing entirely
different types of files in the more sophisticated case. An example is
provided in
examples/ini.js
that shows the store reading and writing an INIfile, while allowing it to be manipulated programmatically in the standard
data-store fashion.