Skip to content

Added code to make slots optional#24

Open
dominicankev wants to merge 13 commits intoalexa-js:masterfrom
dominicankev:master
Open

Added code to make slots optional#24
dominicankev wants to merge 13 commits intoalexa-js:masterfrom
dominicankev:master

Conversation

@dominicankev
Copy link
Copy Markdown

Added code to make slots optional by adding a "+" to the beginning and end of of desired slot name.

For example: {+OPTIONALSLOT+|}

@dblock
Copy link
Copy Markdown
Collaborator

dblock commented Jan 18, 2017

You should write some tests and update README and CHANGELOG, please.

@harrisonhjones
Copy link
Copy Markdown

harrisonhjones commented Jan 18, 2017

@dblock Perhaps it would be a good ideal to add a literal checklist to CONTRIBUTING? Or a issue template? Also there's no mention of updating the changelog in CONTRIBUTING

@dominicankev It looks like you used tabs instead of spaces for indenting your code. Please fix.

@dblock
Copy link
Copy Markdown
Collaborator

dblock commented Jan 18, 2017

@mreinstein is the boss here, but I support this message, maybe you can PR it?

@dominicankev
Copy link
Copy Markdown
Author

Hey guys. I apologize. Kind of new to the GitHub community and might have gotten a bit excited to post a commit. Should I cancel and update the files requested?

@harrisonhjones
Copy link
Copy Markdown

@dominicankev No worries! PRs are (in general) good to see. As for updating this PR see here.

@dominicankev
Copy link
Copy Markdown
Author

@harrisonhjones Thanks! Will make the requested revisions. Thanks all!

@@ -111,15 +111,19 @@ test('exhaustive vs non-exhaustive expansion', function (t) {

test('raw curly braces for custom slot types', function (t) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

In my opinion you should add a new test instead of repurposing an existing one.

test/index.js Outdated
"your favorite fruit is {Fruit} in {ROOM_NAME}",
"my least favorite fruit is {Fruit} in {ROOM_NAME}",
"your least favorite fruit is {Fruit} in {ROOM_NAME}",
"my favorite fruit is {Fruit} ",
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Anyway to get rid of the hanging at the end of the line?

Copy link
Copy Markdown
Author

@dominicankev dominicankev Jan 18, 2017

Choose a reason for hiding this comment

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

@harrisonhjones If I trim the trailing space it seems to break the "optional terms" test which also has trailing spaces in the result. I can add a trim to the returned utterances ( ie: return utterances.trim(); ) but not sure if that would be desired or not.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

No doubt. Here's what I would do:

  1. Update the code to trim the whitespace (or not add it in the first place)
  2. Add a new test for the optional terms which doesn't include the trailing white space
  3. Run all the tests with your new code. They should all pass
  4. Report back if you have issues

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

@harrisonhjones Cool. Thanks. Was thinking of doing that but wasn't sure if the trailing space was desired or not. Assumed it wasn't. It's more of a result of the utterance containing the space and the optional value not being there. Will give it a shot. Thanks again.

CHANGELOG.md Outdated
@@ -1,6 +1,6 @@
### Next
### 0.2.2
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Don't add a version here, the maintainer will do that when they do a release.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

@dblock Thanks. Wasn't sure on that piece. Will update.

### Next
### 0.2.2

* Your contribution here.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Put this back for the next person please.

@dominicankev
Copy link
Copy Markdown
Author

Fixed space vs tab issues and trimmed test to reflect change instead of using existing.

jradwan referenced this pull request in jradwan/alexa_tivo_control Jan 30, 2017
@jradwan
Copy link
Copy Markdown

jradwan commented Aug 20, 2017

Any idea if/when this PR will be merged?

@mreinstein
Copy link
Copy Markdown
Contributor

@dominicankev thanks for taking the time to submit. Please submit a clean PR that includes tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants