MCPcopy
hub / github.com/autoNumeric/autoNumeric / getFormatted

Method getFormatted

src/AutoNumeric.js:2506–2516  ·  view source on GitHub ↗

* Return the current formatted value of the AutoNumeric element as a string * * @usage anElement.getFormatted() * * @param {function|null} callback If a callback is passed, then the result is passed to it as its first argument, and the AutoNumeric object as its second *

(callback = null)

Source from the content-addressed store, hash-verified

2504 * @returns {string}
2505 */
2506 getFormatted(callback = null) {
2507 if (!('value' in this.domElement || 'textContent' in this.domElement)) {
2508 // Make sure `.value` or `.textContent` exists before trying to access those properties
2509 AutoNumericHelper.throwError('Unable to get the formatted string from the element.');
2510 }
2511
2512 const result = AutoNumericHelper.getElementValue(this.domElement);
2513 this._executeCallback(result, callback);
2514
2515 return result;
2516 }
2517
2518 /**
2519 * Return the element unformatted value as a real Javascript number.

Callers 4

isPristineMethod · 0.95
constructorMethod · 0.80

Calls 4

_executeCallbackMethod · 0.95
_getMethod · 0.95
throwErrorMethod · 0.80
getElementValueMethod · 0.80

Tested by

no test coverage detected