mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-10-03 02:21:05 +08:00
- Update Sinon (breaking change does not affect us) - Update Mocha - Update Karma R=jacktfranklin@chromium.org Bug: none Change-Id: Ieb50ba55ce7a9e01e32ee553a6741e6323fcaaab Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3158223 Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org> Commit-Queue: Jack Franklin <jacktfranklin@chromium.org> Auto-Submit: Tim van der Lippe <tvanderlippe@chromium.org> Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
31 lines
871 B
JavaScript
31 lines
871 B
JavaScript
"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;
|