MCPcopy Index your code
hub / github.com/TypeScriptToLua/TypeScriptToLua / set

Method set

src/lualib/Map.ts:91–109  ·  view source on GitHub ↗
(key: K, value: V)

Source from the content-addressed store, hash-verified

89 }
90
91 public set(key: K, value: V): this {
92 const isNewValue = !this.has(key);
93 if (isNewValue) {
94 this.size++;
95 }
96 this.items.set(key, value);
97
98 // Do order bookkeeping
99 if (this.firstKey === undefined) {
100 this.firstKey = key;
101 this.lastKey = key;
102 } else if (isNewValue) {
103 this.nextKey.set(this.lastKey!, key);
104 this.previousKey.set(key, this.lastKey!);
105 this.lastKey = key;
106 }
107
108 return this;
109 }
110
111 public [Symbol.iterator](): IterableIterator<[K, V]> {
112 return this.entries();

Callers 15

detectCyleBenchmarkFunction · 0.95
__TS__MapGroupByFunction · 0.95
constructorMethod · 0.95
getEmitPlanMethod · 0.95
createVisitorMapFunction · 0.95
getTypeAnnotationsFunction · 0.95
_detectCycleFunction · 0.45
markFunction · 0.45
measureFunction · 0.45
getOrUpdateFunction · 0.45
getLuaLibModulesInfoFunction · 0.45

Calls 1

hasMethod · 0.95

Tested by

no test coverage detected