refactor: add Params.resetZdm() to collapse reset+addParam(0) into single call

Replaces 10 separate reset()+addParam(0) pairs across the parser with
a single resetZdm() method that inlines both operations, avoiding two
calls to a foreign object per sequence reset.
This commit is contained in:
Ismail Pelaseyed
2026-04-23 16:55:46 +02:00
parent 32553b4135
commit eaebe2ab15
3 changed files with 23 additions and 18 deletions
+13
View File
@@ -129,6 +129,19 @@ export class Params implements IParams {
this._digitIsSub = false;
}
/**
* Reset and add 0 as first param (ZDM).
*/
public resetZdm(): void {
this.length = 1;
this._subParamsLength = 0;
this._rejectDigits = false;
this._rejectSubDigits = false;
this._digitIsSub = false;
this._subParamsIdx[0] = 0;
this.params[0] = 0;
}
/**
* Add a parameter value.
* `Params` only stores up to `maxLength` parameters, any later