(item: Equivalence<A>)
| 198 | * @since 2.0.0 |
| 199 | */ |
| 200 | export const array = <A>(item: Equivalence<A>): Equivalence<ReadonlyArray<A>> => |
| 201 | make((self, that) => { |
| 202 | if (self.length !== that.length) { |
| 203 | return false |
| 204 | } |
| 205 | |
| 206 | for (let i = 0; i < self.length; i++) { |
| 207 | const isEq = item(self[i], that[i]) |
| 208 | if (!isEq) { |
| 209 | return false |
| 210 | } |
| 211 | } |
| 212 | |
| 213 | return true |
| 214 | }) |
| 215 | |
| 216 | /** |
| 217 | * Given a struct of `Equivalence`s returns a new `Equivalence` that compares values of a struct |