Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

is-subset.js 871B

123456789101112131415161718192021222324252627282930
  1. "use strict";
  2. var forEach = require("@sinonjs/commons").prototypes.set.forEach;
  3. /**
  4. * Returns `true` when `s1` is a subset of `s2`, `false` otherwise
  5. *
  6. * @private
  7. * @param {Array|Set} s1 The target value
  8. * @param {Array|Set} s2 The containing value
  9. * @param {Function} compare A comparison function, should return `true` when
  10. * values are considered equal
  11. * @returns {boolean} Returns `true` when `s1` is a subset of `s2`, `false`` otherwise
  12. */
  13. function isSubset(s1, s2, compare) {
  14. var allContained = true;
  15. forEach(s1, function (v1) {
  16. var includes = false;
  17. forEach(s2, function (v2) {
  18. if (compare(v2, v1)) {
  19. includes = true;
  20. }
  21. });
  22. allContained = allContained && includes;
  23. });
  24. return allContained;
  25. }
  26. module.exports = isSubset;