I'd prefer writing it like this:
dataSearcher = (dataElementelement, identifier) ->
return element if element.identifier is identifier
for child in element.children
found = dataSearcher child, identifier
return found if found
Changes:
- guard style instead of
else
(one less level of indentation) - postfix
if
(probably a question of style) is
instead of==
- shorter variable names
I'd prefer writing it like this:
dataSearcher = (dataElement, identifier) ->
return element if element.identifier is identifier
for child in element.children
found = dataSearcher child, identifier
return found if found
Changes:
- guard style instead of
else
(one less level of indentation) - postfix
if
(probably a question of style) is
instead of==
- shorter variable names
I'd prefer writing it like this:
dataSearcher = (element, identifier) ->
return element if element.identifier is identifier
for child in element.children
found = dataSearcher child, identifier
return found if found
Changes:
- guard style instead of
else
(one less level of indentation) - postfix
if
(probably a question of style) is
instead of==
- shorter variable names
I'd prefer writing it like this:
dataSearcher = (dataElement, identifier) ->
return element if element.identifier is identifier
for child in element.children
found = dataSearcher child, identifier
return found if found
Changes:
- guard style instead of
else
(one less level of indentation) - postfix
if
(probably a question of style) is
instead of==
- shorter variable names
lang-js