(state, ret)
| 118 | } |
| 119 | |
| 120 | function 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 | |
| 143 | function truncateWidth(str, desiredLength) { |
| 144 | if (str.length === strlen(str)) { |
no outgoing calls
no test coverage detected
searching dependent graphs…