MCPcopy Index your code
hub / github.com/loiane/javascript-datastructures-algorithms / isSubsetOf

Method isSubsetOf

src/07-set/set.ts:156–161  ·  view source on GitHub ↗

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

(otherSet: MySet)

Source from the content-addressed store, hash-verified

154 * @complexity Time O(n) | Space O(1)
155 */
156 isSubsetOf(otherSet: MySet): boolean {
157 if (this.size > otherSet.size) {
158 return false;
159 }
160 return this.values().every(value => otherSet.has(value));
161 }
162
163 /**
164 * Returns true if every element of otherSet is also in this set.

Callers 2

filterRecipesFunction · 0.45
set.test.tsFile · 0.45

Calls 2

valuesMethod · 0.95
hasMethod · 0.45

Tested by

no test coverage detected