UNPKG

@inkline/paper

Version:

Paper is a unified interface for defining components for Vue and React using a single code base.

12 lines (11 loc) 428 B
export function unwrapState(state) { const newState = {}; Object.keys(state || {}).forEach((stateKey) => { if (typeof state[stateKey] !== "function" && typeof state[stateKey] === "object" && (state[stateKey].hasOwnProperty("value") || state[stateKey].hasOwnProperty("_value"))) { newState[stateKey] = state[stateKey].value; } else { newState[stateKey] = state[stateKey]; } }); return newState; }