(mode, state)
| 2163 | // Utility functions for working with state. Exported because modes |
| 2164 | // sometimes need to do this. |
| 2165 | function copyState(mode, state) { |
| 2166 | if (state === true) return state; |
| 2167 | if (mode.copyState) return mode.copyState(state); |
| 2168 | var nstate = {}; |
| 2169 | for (var n in state) { |
| 2170 | var val = state[n]; |
| 2171 | if (val instanceof Array) val = val.concat([]); |
| 2172 | nstate[n] = val; |
| 2173 | } |
| 2174 | return nstate; |
| 2175 | } |
| 2176 | CodeMirror.copyState = copyState; |
| 2177 | function startState(mode, a1, a2) { |
| 2178 | return mode.startState ? mode.startState(a1, a2) : true; |
no outgoing calls
no test coverage detected