mirror of
https://github.com/flarum/core.git
synced 2025-08-04 15:37:51 +02:00
common: fix computed util when only passing one key as a string
This commit is contained in:
@@ -2,12 +2,12 @@
|
|||||||
* The `computed` utility creates a function that will cache its output until
|
* The `computed` utility creates a function that will cache its output until
|
||||||
* any of the dependent values are dirty.
|
* any of the dependent values are dirty.
|
||||||
*
|
*
|
||||||
* @param {...String} dependentKeys The keys of the dependent values.
|
* @param dependentKeys The keys of the dependent values.
|
||||||
* @param {function} compute The function which computes the value using the
|
* @param compute The function which computes the value using the
|
||||||
* dependent values.
|
* dependent values.
|
||||||
*/
|
*/
|
||||||
export default function computed(dependentKeys: string | string[], compute: Function): () => any {
|
export default function computed(dependentKeys: string | string[], compute: Function): () => any {
|
||||||
const keys = Array.from(dependentKeys);
|
const keys = [].concat(dependentKeys);
|
||||||
|
|
||||||
const dependentValues = {};
|
const dependentValues = {};
|
||||||
let computedValue;
|
let computedValue;
|
||||||
|
Reference in New Issue
Block a user