@stacksjs/arrays 0.58.63 → 0.58.65
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/package.json +1 -1
- package/src/helpers.ts +3 -3
package/package.json
CHANGED
package/src/helpers.ts
CHANGED
|
@@ -74,12 +74,12 @@ export function partition<T>(array: readonly T[], ...filters: PartitionFilter<T>
|
|
|
74
74
|
let i = 0
|
|
75
75
|
for (const filter of filters) {
|
|
76
76
|
if (filter(e, idx, arr)) {
|
|
77
|
-
result[i]
|
|
77
|
+
result[i]!.push(e)
|
|
78
78
|
return
|
|
79
79
|
}
|
|
80
80
|
i += 1
|
|
81
81
|
}
|
|
82
|
-
result[i]
|
|
82
|
+
result[i]!.push(e)
|
|
83
83
|
})
|
|
84
84
|
return result
|
|
85
85
|
}
|
|
@@ -266,7 +266,7 @@ export function sample<T>(arr: T[], count: number) {
|
|
|
266
266
|
export function shuffle<T>(array: T[]): T[] {
|
|
267
267
|
for (let i = array.length - 1; i > 0; i--) {
|
|
268
268
|
const j = Math.floor(Math.random() * (i + 1));
|
|
269
|
-
[array[i]
|
|
269
|
+
[array[i]!, array[j]!] = [array[j]!, array[i]!]
|
|
270
270
|
}
|
|
271
271
|
return array
|
|
272
272
|
}
|