Skip to content

Commit cc84026

Browse files
committed
refactor: add isDefiningProjection helper re: #5881
1 parent 83d9a98 commit cc84026

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
'use strict';
2+
3+
/*!
4+
* ignore
5+
*/
6+
7+
module.exports = function isDefiningProjection(val) {
8+
if (val == null) {
9+
// `undefined` or `null` become exclusive projections
10+
return true;
11+
}
12+
if (typeof val === 'object') {
13+
// Only cases where a value does **not** define whether the whole projection
14+
// is inclusive or exclusive are `$meta` and `$slice`.
15+
return !('$meta' in val) && !('$slice' in val);
16+
}
17+
return true;
18+
}

0 commit comments

Comments
 (0)