function isSubsetOf(_subset, _superset, cmp, contains, ordered) {
  let superset = Array.from(_superset);
  let subset = Array.from(_subset);
  if (!contains) {
    if (subset.length !== superset.length) return false;
    superset = superset.slice();
  }

  return subset.every(function (elem, idx) {
    if (ordered) return cmp ? cmp(elem, superset[idx]) : elem === superset[idx];

    if (!cmp) {
      let matchIdx = superset.indexOf(elem);
      if (matchIdx === -1) return false;

      // Remove match from superset so not counted twice if duplicate in subset.
      if (!contains) superset.splice(matchIdx, 1);
      return true;
    }

    return superset.some(function (elem2, matchIdx) {
      if (!cmp(elem, elem2)) return false;

      // Remove match from superset so not counted twice if duplicate in subset.
      if (!contains) superset.splice(matchIdx, 1);
      return true;
    });
  });
}
@param {unknown} _subset
@param {unknown} _superset
@param {unknown} cmp
@param {unknown} contains
@param {unknown} ordered
@returns {boolean}