| 11795 | } |
| 11796 | |
| 11797 | public Object parsePrecision(Object precision, Object... optionalArgs) |
| 11798 | { |
| 11799 | /** |
| 11800 | * @ignore |
| 11801 | * @method |
| 11802 | * @param {string} precision The number of digits to the right of the decimal |
| 11803 | * @returns {string} a string number equal to 1e-precision |
| 11804 | */ |
| 11805 | if (Helpers.isTrue(Helpers.isEqual(precision, null))) |
| 11806 | { |
| 11807 | return null; |
| 11808 | } |
| 11809 | Object precisionNumber = Helpers.parseInt(precision); |
| 11810 | if (Helpers.isTrue(Helpers.isEqual(precisionNumber, 0))) |
| 11811 | { |
| 11812 | return "1"; |
| 11813 | } |
| 11814 | if (Helpers.isTrue(Helpers.isGreaterThan(precisionNumber, 0))) |
| 11815 | { |
| 11816 | Object parsedPrecision = "0."; |
| 11817 | for (var i = 0; Helpers.isLessThan(i, Helpers.subtract(precisionNumber, 1)); i++) |
| 11818 | { |
| 11819 | parsedPrecision = Helpers.add(parsedPrecision, "0"); |
| 11820 | } |
| 11821 | return Helpers.add(parsedPrecision, "1"); |
| 11822 | } else |
| 11823 | { |
| 11824 | Object parsedPrecision = "1"; |
| 11825 | for (var i = 0; Helpers.isLessThan(i, Helpers.subtract(Helpers.multiply(precisionNumber, Helpers.opNeg(1)), 1)); i++) |
| 11826 | { |
| 11827 | parsedPrecision = Helpers.add(parsedPrecision, "0"); |
| 11828 | } |
| 11829 | return Helpers.add(parsedPrecision, "0"); |
| 11830 | } |
| 11831 | } |
| 11832 | |
| 11833 | public Object integerPrecisionToAmount(Object precision) |
| 11834 | { |