alexa-js / alexa-utterances

generate expanded utterances for Amazon Alexa from a template string
MIT License
152 stars 28 forks source link

Add ownProperty check to iterator #27

Closed joshgachnang closed 6 years ago

joshgachnang commented 7 years ago

One of the indices returned when iterating utterances was the string 'iterator'. Add a check for hasOwnProperty to avoid an error being thrown.

Using node 6.9.1, calling code was written in Typescript 2.1.4.

My stack trace was:

TypeError: utterances[idx].replace is not a function
  at generateUtterances (/home/josh/src/veronica/node_modules/alexa-utterances/index.js:162:39)
  at /home/josh/src/veronica/node_modules/alexa-app/index.js:460:22
  at Array.forEach (native)
  at utterances (/home/josh/src/veronica/node_modules/alexa-app/index.js:459:34)
  <snip>
dblock commented 7 years ago

You should, please, write a test for this and edit CHANGELOG.

joshgachnang commented 6 years ago

No longer seems to be an issue. I'll add tests and a line in the changelog next time!