mirror of
https://github.com/flarum/framework.git
synced 2025-03-15 00:05:12 +08:00
common: fix computed util when only passing one key as a string
This commit is contained in:
parent
f75c2cfc9c
commit
eae6a11719
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user