MCPcopy Index your code
hub / github.com/nodejs/node / pushIfUnique

Function pushIfUnique

test/fixtures/snapshot/typescript.js:1213–1221  ·  view source on GitHub ↗

* @return Whether the value was added.

(array, toAdd, equalityComparer)

Source from the content-addressed store, hash-verified

1211 * @return Whether the value was added.
1212 */
1213 function pushIfUnique(array, toAdd, equalityComparer) {
1214 if (contains(array, toAdd, equalityComparer)) {
1215 return false;
1216 }
1217 else {
1218 array.push(toAdd);
1219 return true;
1220 }
1221 }
1222 ts.pushIfUnique = pushIfUnique;
1223 /**
1224 * Unlike `pushIfUnique`, this can take `undefined` as an input, and returns a new array.

Callers 3

deduplicateEqualityFunction · 0.85
appendIfUniqueFunction · 0.85
getAllKeysFunction · 0.85

Calls 2

containsFunction · 0.85
pushMethod · 0.45

Tested by

no test coverage detected