1 | 'use strict';
|
2 |
|
3 | const isDefiningProjection = require('./isDefiningProjection');
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 | module.exports = function isInclusive(projection) {
|
10 | if (projection == null) {
|
11 | return false;
|
12 | }
|
13 |
|
14 | const props = Object.keys(projection);
|
15 | const numProps = props.length;
|
16 | if (numProps === 0) {
|
17 | return false;
|
18 | }
|
19 |
|
20 | for (let i = 0; i < numProps; ++i) {
|
21 | const prop = props[i];
|
22 |
|
23 | if (prop.startsWith('+')) {
|
24 | continue;
|
25 | }
|
26 |
|
27 |
|
28 | if (isDefiningProjection(projection[prop]) && !!projection[prop]) {
|
29 | return true;
|
30 | }
|
31 | }
|
32 |
|
33 | return false;
|
34 | };
|