MCPcopy Index your code
hub / github.com/microsoft/pyright / setIfUnique

Method setIfUnique

server/src/common/stringMap.ts:30–38  ·  view source on GitHub ↗
(key: string, value: T)

Source from the content-addressed store, hash-verified

28 // Adds a new entry if the key isn't already defined.
29 // Returns false if it was already present.
30 setIfUnique(key: string, value: T): boolean {
31 const encodedKey = this.encodeKey(key);
32 if (this._map[encodedKey] !== undefined) {
33 return false;
34 }
35
36 this._map[encodedKey] = value;
37 return true;
38 }
39
40 get(key: string): T | undefined {
41 return this._map[this.encodeKey(key)];

Callers

nothing calls this directly

Calls 1

encodeKeyMethod · 0.95

Tested by

no test coverage detected