@globalbrain/sefirot 4.1.1 → 4.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/composables/Utils.ts +12 -1
- package/package.json +1 -1
package/lib/composables/Utils.ts
CHANGED
|
@@ -28,12 +28,23 @@ export function computedWhen<T, C, D>(
|
|
|
28
28
|
|
|
29
29
|
export function computedArray<T = any>(fn: (arr: T[]) => void): ComputedRef<T[]> {
|
|
30
30
|
return computed(() => {
|
|
31
|
-
const arr
|
|
31
|
+
const arr: T[] = []
|
|
32
32
|
fn(arr)
|
|
33
33
|
return arr
|
|
34
34
|
})
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
+
export function computedArrayWhen<T = any, C = any>(
|
|
38
|
+
condition: WhenCondition<C>,
|
|
39
|
+
fn: (arr: T[], item: NonNullable<C>) => void
|
|
40
|
+
): ComputedRef<T[]> {
|
|
41
|
+
return computedWhen<T[], C, T[]>(condition, (c) => {
|
|
42
|
+
const arr: T[] = []
|
|
43
|
+
fn(arr, c)
|
|
44
|
+
return arr
|
|
45
|
+
}, [])
|
|
46
|
+
}
|
|
47
|
+
|
|
37
48
|
/**
|
|
38
49
|
* Checks whether the slot has a non empty value.
|
|
39
50
|
*/
|
package/package.json
CHANGED