MCPcopy Create free account
hub / github.com/cli-table/cli-table3 / updateState

Function updateState

src/utils.js:61–84  ·  view source on GitHub ↗
(state, controlChars)

Source from the content-addressed store, hash-verified

59addToCodeCache('strikethrough', 9, 29);
60
61function updateState(state, controlChars) {
62 let controlCode = controlChars[1] ? parseInt(controlChars[1].split(';')[0]) : 0;
63 if ((controlCode >= 30 && controlCode <= 39) || (controlCode >= 90 && controlCode <= 97)) {
64 state.lastForegroundAdded = controlChars[0];
65 return;
66 }
67 if ((controlCode >= 40 && controlCode <= 49) || (controlCode >= 100 && controlCode <= 107)) {
68 state.lastBackgroundAdded = controlChars[0];
69 return;
70 }
71 if (controlCode === 0) {
72 for (let i in state) {
73 /* istanbul ignore else */
74 if (Object.prototype.hasOwnProperty.call(state, i)) {
75 delete state[i];
76 }
77 }
78 return;
79 }
80 let info = codeCache[controlChars[0]];
81 if (info) {
82 state[info.set] = info.to;
83 }
84}
85
86function readState(line) {
87 let code = codeRegex(true);

Callers 2

readStateFunction · 0.85
truncateWidthWithAnsiFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…