* 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)
| 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. |
no test coverage detected