isPathSelectedInclusive.js 564 B

12345678910111213141516171819202122232425262728
  1. 'use strict';
  2. /*!
  3. * ignore
  4. */
  5. module.exports = function isPathSelectedInclusive(fields, path) {
  6. var chunks = path.split('.');
  7. var cur = '';
  8. var j;
  9. var keys;
  10. var numKeys;
  11. for (var i = 0; i < chunks.length; ++i) {
  12. cur += cur.length ? '.' : '' + chunks[i];
  13. if (fields[cur]) {
  14. keys = Object.keys(fields);
  15. numKeys = keys.length;
  16. for (j = 0; j < numKeys; ++j) {
  17. if (keys[i].indexOf(cur + '.') === 0 && keys[i].indexOf(path) !== 0) {
  18. continue;
  19. }
  20. }
  21. return true;
  22. }
  23. }
  24. return false;
  25. };