Fix bug where `getPrecision` was undefined

- Reorder the Javascript code
- Ensure that we never call `getPrecision` on a string ("")
Merge pull request #2 from sealevelresearch/fix-undefined-function-bug

Fix bug where `getPrecision` was undefined