No need for duplicate runParam

This commit is contained in:
Timothy Farrell 2018-05-31 15:46:33 -05:00
parent ca6dfb8891
commit cac220a127

View File

@ -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);