MCPcopy
hub / github.com/ampproject/amphtml / remove

Method remove

src/core/context/values.js:145–164  ·  view source on GitHub ↗

* Unsets the input value for the specified property and setter. * See `set()` for more info. * @param {IContextProp } prop * @param {function(T):void} setter * @template T

(prop, setter)

Source from the content-addressed store, hash-verified

143 * @template T
144 */
145 remove(prop, setter) {
146 devAssert(setter);
147
148 const {key} = prop;
149 const inputsByKey = this.inputsByKey_;
150 const inputs = inputsByKey?.get(key);
151 if (inputs) {
152 devAssert(inputsByKey);
153
154 const index = inputs.setters.indexOf(setter);
155 if (index != -1) {
156 inputs.setters.splice(index, 1);
157 inputs.values.splice(index, 1);
158 if (inputs.setters.length == 0) {
159 inputsByKey.delete(key);
160 }
161 deepScan(this.contextNode_, scan, prop);
162 }
163 }
164 }
165
166 /**
167 * Whether this node has inputs for the specified property.

Callers 15

fixFunction · 0.45
fixFunction · 0.45
removeFromArrayFunction · 0.45
installAmpTaskRunnerFunction · 0.45
CallExpressionFunction · 0.45
eliminateFunction · 0.45
CallExpressionFunction · 0.45
joinTemplateLiteralsFunction · 0.45
joinMaybeTemplateLiteralFunction · 0.45
replaceObjectPatternFunction · 0.45
ImportDeclarationFunction · 0.45

Calls 4

devAssertFunction · 0.90
deepScanFunction · 0.90
getMethod · 0.45
deleteMethod · 0.45

Tested by

no test coverage detected