Closed ronag closed 2 years ago
It's too many code paths. I'd prefer an approach where an implementation opts-in to support of this option, and must then return the data in the appropriate shape. Rather than abstract-level
normalizing it (with an unexpected performance penalty).
Along the lines of:
this[kFlat] = db.supports.flat && options.flat === true
if (this[kFlat]) {
for (let i = 0; i < items.length; i += 2) {
const key = items[i]
const value = items[i + 1]
// ..
}
} else {
for (const item of items) {
const key = item[0]
const value = item[1]
// ..
}
}
Got it. I'll make a new PR.
Requesting some feedback on whether or not this is a good idea?