Skip to content
Permalink
9bfb9ba527
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
30 lines (26 sloc) 871 Bytes
"use strict";
var forEach = require("@sinonjs/commons").prototypes.set.forEach;
/**
* Returns `true` when `s1` is a subset of `s2`, `false` otherwise
*
* @private
* @param {Array|Set} s1 The target value
* @param {Array|Set} s2 The containing value
* @param {Function} compare A comparison function, should return `true` when
* values are considered equal
* @returns {boolean} Returns `true` when `s1` is a subset of `s2`, `false`` otherwise
*/
function isSubset(s1, s2, compare) {
var allContained = true;
forEach(s1, function (v1) {
var includes = false;
forEach(s2, function (v2) {
if (compare(v2, v1)) {
includes = true;
}
});
allContained = allContained && includes;
});
return allContained;
}
module.exports = isSubset;