(mode, state)
| 2363 | // Utility functions for working with state. Exported because modes |
| 2364 | // sometimes need to do this. |
| 2365 | function copyState(mode, state) { |
| 2366 | if (state === true) return state; |
| 2367 | if (mode.copyState) return mode.copyState(state); |
| 2368 | var nstate = {}; |
| 2369 | for (var n in state) { |
| 2370 | var val = state[n]; |
| 2371 | if (val instanceof Array) val = val.concat([]); |
| 2372 | nstate[n] = val; |
| 2373 | } |
| 2374 | return nstate; |
| 2375 | } |
| 2376 | CodeMirror.copyState = copyState; |
| 2377 | function startState(mode, a1, a2) { |
| 2378 | return mode.startState ? mode.startState(a1, a2) : true; |
no outgoing calls
no test coverage detected