MCPcopy Create free account
hub / github.com/loiane/javascript-datastructures-algorithms / isSupersetOf

Method isSupersetOf

src/07-set/set.ts:169–174  ·  view source on GitHub ↗

* Returns true if every element of otherSet is also in this set. * @param otherSet - The potential subset * @returns Whether this set is a superset of otherSet * @complexity Time O(n) | Space O(1)

(otherSet: MySet)

Source from the content-addressed store, hash-verified

167 * @complexity Time O(n) | Space O(1)
168 */
169 isSupersetOf(otherSet: MySet): boolean {
170 if (this.size < otherSet.size) {
171 return false;
172 }
173 return otherSet.values().every(value => this.has(value));
174 }
175
176 /**
177 * Returns a comma-separated string of all set values.

Callers 1

set.test.tsFile · 0.45

Calls 2

hasMethod · 0.95
valuesMethod · 0.45

Tested by

no test coverage detected