MCPcopy
hub / github.com/autoNumeric/autoNumeric / _getOptionObject

Method _getOptionObject

src/AutoNumeric.js:1145–1158  ·  view source on GitHub ↗

* Return an option object based on the given parameter. * If `optionObjectOrPredefinedName` is as string, then we retrieve the pre-defined option object, if it's an object, we use it as is. * * @param {object|string} optionObjectOrPredefinedName * @returns {object}

(optionObjectOrPredefinedName)

Source from the content-addressed store, hash-verified

1143 * @returns {object}
1144 */
1145 static _getOptionObject(optionObjectOrPredefinedName) {
1146 let options;
1147 if (AutoNumericHelper.isString(optionObjectOrPredefinedName)) {
1148 options = AutoNumeric.getPredefinedOptions()[optionObjectOrPredefinedName];
1149 if (options === void(0) || options === null) {
1150 // If the given pre-defined name does not exist, warn that something is wrong, and continue the execution of the initialization
1151 AutoNumericHelper.warning(`The given pre-defined option [${optionObjectOrPredefinedName}] is not recognized by autoNumeric. Please check that pre-defined option name.`, true);
1152 }
1153 } else { // A `settings` object
1154 options = optionObjectOrPredefinedName;
1155 }
1156
1157 return options;
1158 }
1159
1160 /**
1161 * Save the initial element values for later use in the pristine test.

Callers 4

_setArgumentsValuesMethod · 0.95
mergeOptionsMethod · 0.95
updateMethod · 0.80

Calls 3

isStringMethod · 0.80
getPredefinedOptionsMethod · 0.80
warningMethod · 0.80

Tested by

no test coverage detected