-
Notifications
You must be signed in to change notification settings - Fork 11
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
Add new accessor function getByKeys() #30
Conversation
Codecov Report
@@ Coverage Diff @@
## master #30 +/- ##
=========================================
+ Coverage 69.1% 70.31% +1.2%
=========================================
Files 5 5
Lines 123 128 +5
Branches 19 20 +1
=========================================
+ Hits 85 90 +5
Misses 31 31
Partials 7 7
Continue to review full report at Codecov.
|
@spencerwi Awesome. Thanks for contributing 🥇 👍 🙏. There are few changes I'd request before signing off:
|
Sure, I'll make those changes. I think I misunderstood the original issue. In terms of destructuring, this is legal in Javascript: // assuming the store has {a: 1, b: 2, sum: 3, empty: null}
let {a, b, sum, empty, notFoundThing} = store.getByKeys(['a', 'b', 'sum', 'empty', 'notFoundThing']);
console.log(a) // 1
console.log(b) // 2
console.log(sum) // 3
console.log(empty) // null
console.log(notFoundThing) // undefined |
I've made the changes you requested -- thanks for the feedback! Hopefully the PR in its current state better fits the desired use-case. 😄 |
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.
Great. LGTM 🎉 💯
Added the
getByKeys()
method described in #28, and exercised it in some tests (and updated the README). Y'all's changelog appears autogenerated, so I didn't touch that, as a heads-up.Sorry for the multiple "referenced a commit" over on the issue -- to keep things clean and down to a single commit, I kept force-pushing to my own fork repo (normally bad form, I know, but for a quick PR branch I figured it seemed alright).
Fixes #28