(
call: Extract<Node, { type: "CallExpression" }>
)
| 2226 | |
| 2227 | // .flat()'s depth, 1 by default, or any where the build can't name it |
| 2228 | const flatDepthOf = ( |
| 2229 | call: Extract<Node, { type: "CallExpression" }> |
| 2230 | ): number => { |
| 2231 | const [arg] = call.arguments |
| 2232 | if (!arg) return 1 |
| 2233 | const depth = unwrapExpression(arg) |
| 2234 | return depth.type === "Literal" && typeof depth.value === "number" ? |
| 2235 | depth.value |
| 2236 | : Infinity |
| 2237 | } |
| 2238 | |
| 2239 | // a flatMap() callback returning an array holds it one level shallower than |
| 2240 | // its wrap, as the same call's entry without one does |
no test coverage detected