(mode, state)
| 2259 | } |
| 2260 | |
| 2261 | function copyState(mode, state) { |
| 2262 | if (state === true) { |
| 2263 | return state |
| 2264 | } |
| 2265 | if (mode.copyState) { |
| 2266 | return mode.copyState(state) |
| 2267 | } |
| 2268 | var nstate = {} |
| 2269 | for (var n in state) { |
| 2270 | var val = state[n] |
| 2271 | if (val instanceof Array) { |
| 2272 | val = val.concat([]) |
| 2273 | } |
| 2274 | nstate[n] = val |
| 2275 | } |
| 2276 | return nstate |
| 2277 | } |
| 2278 | |
| 2279 | // Given a mode and a state (for that mode), find the inner mode and |
| 2280 | // state at the position that the state refers to. |
no test coverage detected