| 198 | export const all: < |
| 199 | const Arg extends Iterable<Options.Options<any>> | Record<string, Options.Options<any>> |
| 200 | >(arg: Arg) => Options.All.Return<Arg> = function() { |
| 201 | if (arguments.length === 1) { |
| 202 | if (isOptions(arguments[0])) { |
| 203 | return map(arguments[0], (x) => [x]) as any |
| 204 | } else if (Arr.isArray(arguments[0])) { |
| 205 | return allTupled(arguments[0] as Array<any>) as any |
| 206 | } else { |
| 207 | const entries = Object.entries( |
| 208 | arguments[0] as Readonly<{ [K: string]: Options.Options<any> }> |
| 209 | ) |
| 210 | let result = map(entries[0][1], (value) => ({ [entries[0][0]]: value })) |
| 211 | if (entries.length === 1) { |
| 212 | return result as any |
| 213 | } |
| 214 | const rest = entries.slice(1) |
| 215 | for (const [key, options] of rest) { |
| 216 | result = map(makeBoth(result, options), ([record, value]) => ({ |
| 217 | ...record, |
| 218 | [key]: value |
| 219 | })) |
| 220 | } |
| 221 | return result as any |
| 222 | } |
| 223 | } |
| 224 | return allTupled(arguments[0]) as any |
| 225 | } |
| 226 | |
| 227 | const defaultBooleanOptions = { |
| 228 | ifPresent: true, |