No need for duplicate runParam
This commit is contained in:
parent
6209aae878
commit
b2de97f2b3
@ -9,7 +9,7 @@ export function computed(fn, dependencies = [], hash = id) {
|
|||||||
// Compute new value, call subscribers if changed.
|
// Compute new value, call subscribers if changed.
|
||||||
const accessor = function _computed() {
|
const accessor = function _computed() {
|
||||||
if (isDirty) {
|
if (isDirty) {
|
||||||
const newVal = fn.apply(null, dependencies.map(runParam));
|
const newVal = fn.apply(null, dependencies.map(call));
|
||||||
isDirty = false;
|
isDirty = false;
|
||||||
const newId = hash(newVal);
|
const newId = hash(newVal);
|
||||||
if (oldId !== newId) {
|
if (oldId !== newId) {
|
||||||
@ -49,5 +49,3 @@ export function computed(fn, dependencies = [], hash = id) {
|
|||||||
|
|
||||||
return accessor;
|
return accessor;
|
||||||
}
|
}
|
||||||
|
|
||||||
const runParam = a => (typeof a === 'function' ? a() : a);
|
|
||||||
|
|||||||
Reference in New Issue
Block a user