isDefiningProjection.js 435 B

123456789101112131415161718
  1. 'use strict';
  2. /*!
  3. * ignore
  4. */
  5. module.exports = function isDefiningProjection(val) {
  6. if (val == null) {
  7. // `undefined` or `null` become exclusive projections
  8. return true;
  9. }
  10. if (typeof val === 'object') {
  11. // Only cases where a value does **not** define whether the whole projection
  12. // is inclusive or exclusive are `$meta` and `$slice`.
  13. return !('$meta' in val) && !('$slice' in val);
  14. }
  15. return true;
  16. };