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

Commit

Permalink
Merge pull request #841 from pangratz/master
Browse files Browse the repository at this point in the history
Fix typo in children_of_type method
  • Loading branch information
Tom Bell committed Mar 25, 2013
2 parents c0e09dd + 4586722 commit 1ccc77f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/scripts/itcrowd.coffee
Expand Up @@ -32,7 +32,7 @@ module.exports = (robot) ->

get_quote = (msg, quotes) ->

nodeChildren = _.flatten childern_of_type(quotes[Math.floor(Math.random() * quotes.length)])
nodeChildren = _.flatten children_of_type(quotes[Math.floor(Math.random() * quotes.length)])
quote = (textNode.data for textNode in nodeChildren).join(' ').replace(/^\s+|\s+$/g, '')

msg.send quote
Expand All @@ -45,11 +45,11 @@ parse_html = (html, selector) ->
parser.parseComplete html
Select handler.dom, selector

childern_of_type = (root) ->
children_of_type = (root) ->
return [root] if root?.type is "text"

if root?.children?.length > 0
return (childern_of_type(child) for child in root.children)
return (children_of_type(child) for child in root.children)

get_dom = (xml) ->
body = JsDom.jsdom(xml)
Expand Down

0 comments on commit 1ccc77f

Please sign in to comment.