@@ -19,9 +19,10 @@ import {
19
19
} from "./internal/originals.ts" ;
20
20
import { isComposite } from "./composite.ts" ;
21
21
import { resolveKey , missing , clearCompMap , deleteKey } from "./internal/key-lookup.ts" ;
22
+ import { EMPTY } from "./internal/utils.ts" ;
22
23
23
24
function requireInternalSlot ( that : unknown ) : void {
24
- apply ( setSize , that , [ ] ) ;
25
+ apply ( setSize , that , EMPTY ) ;
25
26
}
26
27
27
28
function setPrototypeAdd < T > ( this : Set < T > , value : T ) : Set < T > {
@@ -33,7 +34,7 @@ function setPrototypeAdd<T>(this: Set<T>, value: T): Set<T> {
33
34
34
35
function setPrototypeClear ( this : Set < any > ) : void {
35
36
requireInternalSlot ( this ) ;
36
- apply ( setClear , this , [ ] ) ;
37
+ apply ( setClear , this , EMPTY ) ;
37
38
clearCompMap ( this ) ;
38
39
}
39
40
@@ -76,7 +77,7 @@ function setPrototypeIntersection<T, U>(this: Set<T>, other: ReadonlySetLike<U>)
76
77
requireInternalSlot ( this ) ;
77
78
const otherSet = getSetRecord ( other ) ;
78
79
const result = new Set < any > ( ) ;
79
- if ( apply ( setSize , this , [ ] ) <= otherSet . size ) {
80
+ if ( apply ( setSize , this , EMPTY ) <= otherSet . size ) {
80
81
for ( const value of setIterator ( this ) ) {
81
82
if ( otherSet . has ( value ) ) {
82
83
apply ( setPrototypeAdd , result , [ value ] ) ;
@@ -133,7 +134,7 @@ function setPrototypeSymmetricDifference<T, U>(this: Set<T>, other: ReadonlySetL
133
134
function setPrototypeIsSubsetOf < T , U > ( this : Set < T > , other : ReadonlySetLike < U > ) : boolean {
134
135
requireInternalSlot ( this ) ;
135
136
const otherSet = getSetRecord ( other ) ;
136
- if ( apply ( setSize , this , [ ] ) > otherSet . size ) return false ;
137
+ if ( apply ( setSize , this , EMPTY ) > otherSet . size ) return false ;
137
138
for ( const value of setIterator ( this ) ) {
138
139
if ( ! otherSet . has ( value ) ) {
139
140
return false ;
@@ -145,7 +146,7 @@ function setPrototypeIsSubsetOf<T, U>(this: Set<T>, other: ReadonlySetLike<U>):
145
146
function setPrototypeIsSupersetOf < T , U > ( this : Set < T > , other : ReadonlySetLike < U > ) : boolean {
146
147
requireInternalSlot ( this ) ;
147
148
const otherSet = getSetRecord ( other ) ;
148
- if ( apply ( setSize , this , [ ] ) < otherSet . size ) return false ;
149
+ if ( apply ( setSize , this , EMPTY ) < otherSet . size ) return false ;
149
150
for ( const value of otherSet . keys ( ) ) {
150
151
if ( ! apply ( setPrototypeHas , this , [ value ] ) ) {
151
152
return false ;
@@ -158,7 +159,7 @@ function setPrototypeIsDisjointFrom<T, U>(this: Set<T>, other: ReadonlySetLike<U
158
159
requireInternalSlot ( this ) ;
159
160
const otherSet = getSetRecord ( other ) ;
160
161
161
- if ( apply ( setSize , this , [ ] ) <= otherSet . size ) {
162
+ if ( apply ( setSize , this , EMPTY ) <= otherSet . size ) {
162
163
for ( const value of setIterator ( this ) ) {
163
164
if ( otherSet . has ( value ) ) {
164
165
return false ;
@@ -183,7 +184,7 @@ const setIteratorProto = {
183
184
return this ;
184
185
} ,
185
186
next ( ) {
186
- return apply ( this . nextFn , this . it , [ ] ) ;
187
+ return apply ( this . nextFn , this . it , EMPTY ) ;
187
188
} ,
188
189
return ( value : any ) {
189
190
const ret = this . it . return ;
@@ -198,7 +199,7 @@ const setIteratorProto = {
198
199
} ;
199
200
200
201
function setIterator < T > ( set : Set < T > ) : Iterable < T > {
201
- const it = apply ( setValues , set , [ ] ) ;
202
+ const it = apply ( setValues , set , EMPTY ) ;
202
203
return {
203
204
__proto__ : setIteratorProto ,
204
205
nextFn : setNext ,
@@ -244,7 +245,7 @@ function getSetRecord(other: ReadonlySetLike<unknown>) {
244
245
return Boolean ( apply ( has , other , [ v ] ) ) ;
245
246
} ,
246
247
keys ( ) : Iterable < any > {
247
- const it = apply ( keys , other , [ ] ) ;
248
+ const it = apply ( keys , other , EMPTY ) ;
248
249
if ( it === null || typeof it !== "object" ) {
249
250
throw new TypeError ( "invalid keys" ) ;
250
251
}
0 commit comments