Skip to content
This repository has been archived by the owner on Dec 15, 2023. It is now read-only.

Update method names #13

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Update method names #13

wants to merge 4 commits into from

Conversation

Trudeaucj
Copy link

Update method name of remove to delete to follow standards set here: https://github.com/howdyai/botkit/blob/master/docs/storage.md

@colestrode
Copy link
Contributor

Thanks for the PR and bringing this in line with the storage interface 😄 I added a few comments, nothing too big. Thanks again!

src/index.js Outdated
@@ -35,6 +35,9 @@ module.exports = function(config) {
* @returns {{get: get, save: save, all: all, allById: allById}}
*/
function getStorageObj(client, namespace) {
var delete = function(id, cb) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would you mind changing this to a function declaration (function delete(id, cb) {...})? That avoids any possible problems introduced by hoisting.

client.hdel(namespace, [id], cb);
return delete(id, cb);
},
delete: function(id, cb) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you mind covering this new method with tests? You can just copy the tests for remove and rename the describe and method call, since these should behave identically.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@@ -35,6 +35,9 @@ module.exports = function(config) {
* @returns {{get: get, save: save, all: all, allById: allById}}
*/
function getStorageObj(client, namespace) {
function delete(id, cb) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm running this locally, turns out delete is a reserve word, could you change it to something else? Also you won't need a semi-colon after a function declaration. A little whitespace after the function would be nice too 😄 Otherwise things look great!

@imjul1an
Copy link

imjul1an commented Feb 19, 2018

@Trudeaucj hey, thanks for a PR, there is already issue created for this issue #14. Please reference it in the body of this PR as Close #14. So, the issue can be closed automatically, when PR is merged.

@imjul1an
Copy link

Ref. to existing issue #14

@peterswimm peterswimm requested a review from benbrown February 20, 2018 13:20
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants