This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Checks the float precision of a number in JavaScript wether it's a number or string | |
* @param {Number}/{String} number to be checked, can be string representation | |
* @param {Number} precision, max amount of characters not counting minus and . | |
* @param {Number} decimals, max amount of decimal characters | |
* @return {Boolean} value satisfies precision and decimals | |
* | |
* Example: | |
* - checkPrecision(12.3456, 6, 2) -> false, too many decimals | |
* - checkPrecision(-123456.7, 6, 2) -> false, too many total characters |