is-subset.js 382 B

123456789101112131415161718
  1. "use strict";
  2. function isSubset(s1, s2, compare) {
  3. var allContained = true;
  4. s1.forEach(function(v1) {
  5. var includes = false;
  6. s2.forEach(function(v2) {
  7. if (compare(v2, v1)) {
  8. includes = true;
  9. }
  10. });
  11. allContained = allContained && includes;
  12. });
  13. return allContained;
  14. }
  15. module.exports = isSubset;