| 196 | } |
| 197 | |
| 198 | asymmetricMatch(other: unknown) { |
| 199 | if (!Array.isArray(this.sample)) { |
| 200 | throw new TypeError( |
| 201 | `You must provide an array to ${this.toString()}, not '${typeof this |
| 202 | .sample}'.`, |
| 203 | ); |
| 204 | } |
| 205 | |
| 206 | const matcherContext = this.getMatcherContext(); |
| 207 | const result = |
| 208 | this.sample.length === 0 || |
| 209 | (Array.isArray(other) && |
| 210 | this.sample.every(item => |
| 211 | other.some(another => |
| 212 | equals(item, another, matcherContext.customTesters), |
| 213 | ), |
| 214 | )); |
| 215 | |
| 216 | return this.inverse ? !result : result; |
| 217 | } |
| 218 | |
| 219 | toString() { |
| 220 | return `Array${this.inverse ? 'Not' : ''}Containing`; |