( fields: R )
| 240 | * @since 2.0.0 |
| 241 | */ |
| 242 | export const struct = <R extends { readonly [x: string]: Order<any> }>( |
| 243 | fields: R |
| 244 | ): Order<{ [K in keyof R]: [R[K]] extends [Order<infer A>] ? A : never }> => { |
| 245 | const keys = Object.keys(fields) |
| 246 | return make((self, that) => { |
| 247 | for (const key of keys) { |
| 248 | const o = fields[key](self[key], that[key]) |
| 249 | if (o !== 0) { |
| 250 | return o |
| 251 | } |
| 252 | } |
| 253 | return 0 |
| 254 | }) |
| 255 | } |
| 256 | |
| 257 | /** |
| 258 | * Test whether one value is _strictly less than_ another. |