(obj)
| 268 | } |
| 269 | |
| 270 | ajustIMaskOptions (obj) { |
| 271 | /* iMask config format is not JSON friendly, so function and regex based mask */ |
| 272 | /* properties have to be adjusted from string to the correct format */ |
| 273 | Object.keys(obj).forEach(prop => { |
| 274 | if (obj[prop] === Object(obj[prop])) obj[prop] = this.ajustIMaskOptions(obj[prop]) |
| 275 | else if (prop === 'mask') { |
| 276 | if (obj[prop].substr(0, 6) === 'regex:') { |
| 277 | const regExMatch = obj[prop].match(/^regex:\/(.*)\/([gimsuy]*)$/) |
| 278 | if (regExMatch !== null) { |
| 279 | try { |
| 280 | obj[prop] = new RegExp(regExMatch[1], regExMatch[2]) |
| 281 | } catch (e) { } |
| 282 | } |
| 283 | } else obj[prop] = this.getGlobalPropertyFromString(obj[prop]) |
| 284 | } |
| 285 | }) |
| 286 | return obj |
| 287 | } |
| 288 | |
| 289 | getGlobalPropertyFromString (strValue) { |
| 290 | if (!strValue.includes('.')) { |
no test coverage detected