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

Function rewindState

src/utils.js:120–141  ·  view source on GitHub ↗
(state, ret)

Source from the content-addressed store, hash-verified

118}
119
120function rewindState(state, ret) {
121 let lastBackgroundAdded = state.lastBackgroundAdded;
122 let lastForegroundAdded = state.lastForegroundAdded;
123
124 delete state.lastBackgroundAdded;
125 delete state.lastForegroundAdded;
126
127 Object.keys(state).forEach(function (key) {
128 if (state[key]) {
129 ret = codeCache[key].on + ret;
130 }
131 });
132
133 if (lastBackgroundAdded && lastBackgroundAdded != '\u001b[49m') {
134 ret = lastBackgroundAdded + ret;
135 }
136 if (lastForegroundAdded && lastForegroundAdded != '\u001b[39m') {
137 ret = lastForegroundAdded + ret;
138 }
139
140 return ret;
141}
142
143function truncateWidth(str, desiredLength) {
144 if (str.length === strlen(str)) {

Callers 1

colorizeLinesFunction · 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…