Skip to content

Commit

Permalink
add condition
Browse files Browse the repository at this point in the history
  • Loading branch information
akki2825 committed Apr 14, 2019
1 parent 8f55308 commit 8e2677a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions num2words/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@ def num2words(number, ordinal=False, lang='en', to='cardinal', **kwargs):
if lang not in CONVERTER_CLASSES:
raise NotImplementedError()
converter = CONVERTER_CLASSES[lang]

if isinstance(number, str):
number = converter.str_to_number(number)

# backwards compatible
if ordinal:
return converter.to_ordinal(number)
Expand Down

0 comments on commit 8e2677a

Please sign in to comment.