MCPcopy
hub / github.com/autoNumeric/autoNumeric / _validateDecimalPlacesRawValue

Method _validateDecimalPlacesRawValue

src/AutoNumeric.js:4310–4328  ·  view source on GitHub ↗

* Check the `decimalPlaces*` options and output the relevant warnings if some of those will get overwritten during the initialization or settings update. * * @param {object} options * @private

(options)

Source from the content-addressed store, hash-verified

4308 * @private
4309 */
4310 static _validateDecimalPlacesRawValue(options) {
4311 // Checks if the number of decimal places for the raw value is lower than the `decimalPlaces`, `decimalPlacesShownOnFocus` and/or `decimalPlacesShownOnBlur` options
4312 if (!AutoNumericHelper.isNull(options.decimalPlacesRawValue)) {
4313 if (options.decimalPlacesRawValue < options.decimalPlaces) {
4314 AutoNumericHelper.warning(`The number of decimal places to store in the raw value [${options.decimalPlacesRawValue}] is lower than the ones to display [${options.decimalPlaces}]. This will likely confuse your users.
4315To solve that, you'd need to either set \`decimalPlacesRawValue\` to \`null\`, or set a number of decimal places for the raw value equal of bigger than \`decimalPlaces\`.`, options.showWarnings);
4316 }
4317
4318 if (options.decimalPlacesRawValue < options.decimalPlacesShownOnFocus) {
4319 AutoNumericHelper.warning(`The number of decimal places to store in the raw value [${options.decimalPlacesRawValue}] is lower than the ones shown on focus [${options.decimalPlacesShownOnFocus}]. This will likely confuse your users.
4320To solve that, you'd need to either set \`decimalPlacesRawValue\` to \`null\`, or set a number of decimal places for the raw value equal of bigger than \`decimalPlacesShownOnFocus\`.`, options.showWarnings);
4321 }
4322
4323 if (options.decimalPlacesRawValue < options.decimalPlacesShownOnBlur) {
4324 AutoNumericHelper.warning(`The number of decimal places to store in the raw value [${options.decimalPlacesRawValue}] is lower than the ones shown when unfocused [${options.decimalPlacesShownOnBlur}]. This will likely confuse your users.
4325To solve that, you'd need to either set \`decimalPlacesRawValue\` to \`null\`, or set a number of decimal places for the raw value equal of bigger than \`decimalPlacesShownOnBlur\`.`, options.showWarnings);
4326 }
4327 }
4328 }
4329
4330 /**
4331 * Return `true` if the settings/options are valid, `false` otherwise.

Callers 3

validateMethod · 0.95

Calls 2

isNullMethod · 0.80
warningMethod · 0.80

Tested by

no test coverage detected