MCPcopy
hub / github.com/uNmAnNeR/imaskjs / push

Method push

packages/imask/src/controls/input-history.ts:25–31  ·  view source on GitHub ↗
(state: InputHistoryState)

Source from the content-addressed store, hash-verified

23 }
24
25 push (state: InputHistoryState) {
26 // if current index points before the last element then remove the future
27 if (this.currentIndex < this.states.length - 1) this.states.length = this.currentIndex + 1;
28 this.states.push(state);
29 if (this.states.length > InputHistory.MAX_LENGTH) this.states.shift();
30 this.currentIndex = this.states.length - 1;
31 }
32
33 go (steps: number): InputHistoryState | undefined {
34 this.currentIndex = Math.min(Math.max(this.currentIndex + steps, 0), this.states.length - 1);

Callers 8

input-history.tsFile · 0.80
_allocateBlockMethod · 0.80
_padFractionalZerosMethod · 0.80
_rebuildMaskMethod · 0.80
extendMethod · 0.80
pushStateMethod · 0.80
updateControlMethod · 0.80
onMethod · 0.80

Calls 1

shiftMethod · 0.65

Tested by

no test coverage detected