mirror of
https://github.com/SukkaW/Surge.git
synced 2026-02-02 12:01:53 +08:00
Perf: minor optimization here and there
This commit is contained in:
8
Build/lib/set-add-from-array.ts
Normal file
8
Build/lib/set-add-from-array.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* In-place adding of elements from an array to a set.
|
||||
*/
|
||||
export function setAddFromArray<T>(set: Set<T>, arr: T[]): void {
|
||||
for (let i = 0, len = arr.length; i < len; i++) {
|
||||
set.add(arr[i]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user