MCPcopy
hub / github.com/autoNumeric/autoNumeric / decimalPlaces

Method decimalPlaces

src/AutoNumericHelper.js:297–304  ·  view source on GitHub ↗

* Return the number of decimal places if the parameter is a string that represents a float number, and that number has a decimal part. * * @param {string} str * @returns {int}

(str)

Source from the content-addressed store, hash-verified

295 * @returns {int}
296 */
297 static decimalPlaces(str) {
298 const [, decimalPart] = str.split('.');
299 if (!this.isUndefined(decimalPart)) {
300 return decimalPart.length;
301 }
302
303 return 0;
304 }
305
306 /**
307 * Return the index of the first non-zero decimal place in the given value.

Callers 1

Calls 1

isUndefinedMethod · 0.95

Tested by

no test coverage detected