UNPKG

@inkline/paper

Version:

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

18 lines (16 loc) 534 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.unwrapState = unwrapState; 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; }