* Returns the amount of matches for a given key * @private * @param {Array} keys * @param {Array} propertiesInfo
(keys, propertiesInfo)
| 298 | * @param {Array} propertiesInfo |
| 299 | */ |
| 300 | function keysAreIncluded(keys, propertiesInfo) { |
| 301 | if (keys.length === 0) { |
| 302 | return keyMatches.all; |
| 303 | } |
| 304 | |
| 305 | // Filtering by name might look slow / ineffective to using hash maps |
| 306 | // but we expect `keys` and `propertiesInfo` to contain only few items |
| 307 | const matches = propertiesInfo.reduce((acc, p) => acc + (contains(keys, k => p.columnName === k.name) ? 1 : 0), 0); |
| 308 | if (matches === 0) { |
| 309 | return keyMatches.none; |
| 310 | } |
| 311 | |
| 312 | return matches === keys.length ? keyMatches.all : keyMatches.some; |
| 313 | } |
| 314 | |
| 315 | function hasStaticColumn(table) { |
| 316 | return staticColumnCount(table) > 0; |
no test coverage detected