common: fix computed util when only passing one key as a string

This commit is contained in:
David Sevilla Martin 2020-02-01 09:45:12 -05:00
parent f75c2cfc9c
commit eae6a11719
No known key found for this signature in database
GPG Key ID: F764F1417E16B15F

View File

@ -2,12 +2,12 @@
* The `computed` utility creates a function that will cache its output until
* any of the dependent values are dirty.
*
* @param {...String} dependentKeys The keys of the dependent values.
* @param {function} compute The function which computes the value using the
* @param dependentKeys The keys of the dependent values.
* @param compute The function which computes the value using the
* dependent values.
*/
export default function computed(dependentKeys: string | string[], compute: Function): () => any {
const keys = Array.from(dependentKeys);
const keys = [].concat(dependentKeys);
const dependentValues = {};
let computedValue;