simplified syntax for

pull/4187/head
AnatoleLucet 6 years ago
parent b0f155af60
commit 4c381343e4

@ -129,27 +129,19 @@ export function init(component, options, instance, create_fragment, not_equal, p
$$.ctx = instance
? instance(component, prop_values, (args) => {
let { i, ret, value } = args;
const isValuePassed = !!Object.keys(args).find(e => e === 'value');
const assign = () => {
if ($$.ctx) {
const isValuePassed = !!Object.keys(args).find(e => e === 'value');
value = isValuePassed ? value : (value || ret);
if (not_equal($$.ctx[i], ($$.ctx[i] = value))) {
if ($$.bound[i]) $$.bound[i](value);
if (ready) make_dirty(component, i);
}
};
if ($$.ctx) {
if (!isValuePassed && typeof $$.ctx[i] === 'undefined') {
assign();
return ret;
}
value = isValuePassed ? value : (value || ret);
assign();
}
return ret;
})
: [];

Loading…
Cancel
Save