MCPcopy Create free account
hub / github.com/dipscope/TypeManager.TS / hasCustomValueMap

Method hasCustomValueMap

src/type-metadata.ts:1118–1145  ·  view source on GitHub ↗

* Configures custom value map. * * @param {Optional , CustomValue>>} customValueMap Custom value map or undefined. * * @returns {this} Current instance of type metadata.

(customValueMap: Optional<Map<CustomKey<any>, CustomValue>>)

Source from the content-addressed store, hash-verified

1116 * @returns {this} Current instance of type metadata.
1117 */
1118 public hasCustomValueMap(customValueMap: Optional<Map<CustomKey<any>, CustomValue>>): this
1119 {
1120 let currentCustomValueMap = this.typeOptions.customValueMap;
1121
1122 if (currentCustomValueMap === undefined)
1123 {
1124 currentCustomValueMap = new Map<CustomKey<any>, CustomValue>();
1125
1126 this.typeOptions.customValueMap = currentCustomValueMap;
1127 }
1128
1129 if (customValueMap !== undefined)
1130 {
1131 if (currentCustomValueMap !== customValueMap)
1132 {
1133 currentCustomValueMap.clear();
1134 }
1135
1136 for (const [customKey, customValue] of customValueMap)
1137 {
1138 currentCustomValueMap.set(customKey, customValue);
1139 }
1140 }
1141
1142 this.currentTypeState = new UnresolvedTypeState<TObject>(this);
1143
1144 return this;
1145 }
1146
1147 /**
1148 * Configures custom value.

Callers 1

configureMethod · 0.95

Calls 2

clearMethod · 0.80
setMethod · 0.80

Tested by

no test coverage detected