| 424 | } |
| 425 | |
| 426 | function processCommandObject(commandObj) { |
| 427 | if (commandObj !== undefined) { |
| 428 | if (commandObj.remove !== undefined) { |
| 429 | // remove position(s) |
| 430 | if (!Array.isArray(commandObj.remove)) |
| 431 | commandObj.remove = [commandObj.remove]; |
| 432 | commandObj.remove |
| 433 | .sort(function (a, b) { |
| 434 | return inputmask.isRTL ? a.pos - b.pos : b.pos - a.pos; |
| 435 | }) |
| 436 | .forEach(function (lmnt) { |
| 437 | revalidateMask.call(inputmask, { begin: lmnt, end: lmnt + 1 }); |
| 438 | }); |
| 439 | commandObj.remove = undefined; |
| 440 | } |
| 441 | if (commandObj.insert !== undefined) { |
| 442 | // insert position(s) |
| 443 | if (!Array.isArray(commandObj.insert)) |
| 444 | commandObj.insert = [commandObj.insert]; |
| 445 | commandObj.insert |
| 446 | .sort(function (a, b) { |
| 447 | return inputmask.isRTL ? b.pos - a.pos : a.pos - b.pos; |
| 448 | }) |
| 449 | .forEach(function (lmnt) { |
| 450 | if (lmnt.c !== "") { |
| 451 | isValid.call( |
| 452 | inputmask, |
| 453 | lmnt.pos, |
| 454 | lmnt.c, |
| 455 | lmnt.strict !== undefined ? lmnt.strict : true, |
| 456 | lmnt.fromIsValid !== undefined ? lmnt.fromIsValid : fromIsValid |
| 457 | ); |
| 458 | } |
| 459 | }); |
| 460 | commandObj.insert = undefined; |
| 461 | } |
| 462 | |
| 463 | if (commandObj.refreshFromBuffer && commandObj.buffer) { |
| 464 | const refresh = commandObj.refreshFromBuffer; |
| 465 | refreshFromBuffer.call( |
| 466 | inputmask, |
| 467 | refresh === true ? refresh : refresh.start, |
| 468 | refresh.end, |
| 469 | commandObj.buffer |
| 470 | ); |
| 471 | commandObj.refreshFromBuffer = undefined; |
| 472 | } |
| 473 | |
| 474 | if (commandObj.rewritePosition !== undefined) { |
| 475 | maskPos = commandObj.rewritePosition; |
| 476 | // commandObj.rewritePosition = undefined; |
| 477 | commandObj = true; // see prevalidation in isValid |
| 478 | } |
| 479 | } |
| 480 | return commandObj; |
| 481 | } |
| 482 | |
| 483 | function _isValid(position, c, strict) { |