(options?: FlatLoaderOptions)
| 23 | * @param options.shouldPreserveObject - Predicate to identify objects that should not be flattened |
| 24 | */ |
| 25 | export default function createFlatLoader(options?: FlatLoaderOptions) { |
| 26 | const composedLoader = composeLoaders( |
| 27 | createDenormalizeLoader(options), |
| 28 | createNormalizeLoader(), |
| 29 | ); |
| 30 | |
| 31 | return { |
| 32 | ...composedLoader, |
| 33 | pullHints: async (input: Record<string, any>) => { |
| 34 | if (!input || typeof input !== "object") { |
| 35 | return {}; |
| 36 | } |
| 37 | return flattenHints(input); |
| 38 | }, |
| 39 | }; |
| 40 | } |
| 41 | |
| 42 | type DenormalizeResult = { |
| 43 | denormalized: Record<string, string>; |
no test coverage detected