MCPcopy
hub / github.com/plotly/plotly.js / setArrayAll

Function setArrayAll

src/lib/nested_property.js:195–217  ·  view source on GitHub ↗
(containerArray, innerParts, val, propStr)

Source from the content-addressed store, hash-verified

193
194// handle special -1 array index
195function setArrayAll(containerArray, innerParts, val, propStr) {
196 var arrayVal = isArrayOrTypedArray(val);
197 var allSet = true;
198 var thisVal = val;
199 var thisPropStr = propStr.replace('-1', 0);
200 var deleteThis = arrayVal ? false : isDeletable(val, thisPropStr);
201 var firstPart = innerParts[0];
202 var i;
203
204 for(i = 0; i < containerArray.length; i++) {
205 thisPropStr = propStr.replace('-1', i);
206 if(arrayVal) {
207 thisVal = val[i % val.length];
208 deleteThis = isDeletable(thisVal, thisPropStr);
209 }
210 if(deleteThis) allSet = false;
211 if(!checkNewContainer(containerArray, i, firstPart, deleteThis)) {
212 continue;
213 }
214 npSet(containerArray[i], innerParts, propStr.replace('-1', i))(thisVal);
215 }
216 return allSet;
217}
218
219/**
220 * make new sub-container as needed.

Callers 1

npSetFunction · 0.85

Calls 4

isDeletableFunction · 0.85
checkNewContainerFunction · 0.85
npSetFunction · 0.85
isArrayOrTypedArrayFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…