@cicada/render
Advanced tools
Comparing version 1.1.22-alpha3 to 1.1.22-alpha4
@@ -92,2 +92,4 @@ 'use strict'; | ||
var proxy = {}; | ||
function setStateValue(statePath, value) { | ||
@@ -128,21 +130,26 @@ for (var _len2 = arguments.length, arg = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) { | ||
return { | ||
get: function get(statePath) { | ||
var _instance$stateTree3; | ||
function getStateValue(statePath) { | ||
var _instance$stateTree3; | ||
for (var _len3 = arguments.length, arg = Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) { | ||
arg[_key3 - 1] = arguments[_key3]; | ||
} | ||
for (var _len3 = arguments.length, arg = Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) { | ||
arg[_key3 - 1] = arguments[_key3]; | ||
} | ||
if (/^value/.test(statePath)) return (_instance$stateTree3 = instance.stateTree).get.apply(_instance$stateTree3, [removePathHeader(statePath, 'value')].concat(arg)); | ||
if (/^config/.test(statePath)) return _exist2.default.get.apply(_exist2.default, [instance.config, removePathHeader(statePath, 'config')].concat(arg)); | ||
if (statePath === '') { | ||
return { | ||
config: instance.config, | ||
value: instance.stateTree.get('') | ||
}; | ||
} | ||
throw new Error('get unknown state name: ' + statePath); | ||
}, | ||
set: function set(statePath, value) { | ||
if (/^value/.test(statePath)) return (_instance$stateTree3 = instance.stateTree).get.apply(_instance$stateTree3, [removePathHeader(statePath, 'value')].concat(arg)); | ||
if (/^config/.test(statePath)) return _exist2.default.get.apply(_exist2.default, [instance.config, removePathHeader(statePath, 'config')].concat(arg)); | ||
if (statePath === '') { | ||
return { | ||
config: instance.config, | ||
value: instance.stateTree.get('') | ||
}; | ||
} | ||
throw new Error('get unknown state name: ' + statePath); | ||
} | ||
Object.defineProperty(proxy, 'get', { | ||
value: getStateValue | ||
}); | ||
Object.defineProperty(proxy, 'set', { | ||
value: function set(statePath, value) { | ||
for (var _len4 = arguments.length, arg = Array(_len4 > 2 ? _len4 - 2 : 0), _key4 = 2; _key4 < _len4; _key4++) { | ||
@@ -161,3 +168,5 @@ arg[_key4 - 2] = arguments[_key4]; | ||
} | ||
}; | ||
}); | ||
return proxy; | ||
}; | ||
@@ -164,0 +173,0 @@ |
{ | ||
"name": "@cicada/render", | ||
"version": "1.1.22-alpha3", | ||
"version": "1.1.22-alpha4", | ||
"main": "./lib/index.js", | ||
@@ -5,0 +5,0 @@ "scripts": { |
409954
9906