MCPcopy
hub / github.com/apache/echarts / clone

Method clone

src/data/DataStore.ts:1228–1252  ·  view source on GitHub ↗

* Clone shallow. * * @param clonedDims Determine which dims to clone. Will share the data if not specified.

(clonedDims?: DimensionIndex[], ignoreIndices?: boolean)

Source from the content-addressed store, hash-verified

1226 * @param clonedDims Determine which dims to clone. Will share the data if not specified.
1227 */
1228 clone(clonedDims?: DimensionIndex[], ignoreIndices?: boolean): DataStore {
1229 const target = new DataStore();
1230 const chunks = this._chunks;
1231 const clonedDimsMap = clonedDims && reduce(clonedDims, (obj, dimIdx) => {
1232 obj[dimIdx] = true;
1233 return obj;
1234 }, {} as Record<DimensionIndex, boolean>);
1235
1236 if (clonedDimsMap) {
1237 for (let i = 0; i < chunks.length; i++) {
1238 // Not clone if dim is not picked.
1239 target._chunks[i] = !clonedDimsMap[i] ? chunks[i] : cloneChunk(chunks[i]);
1240 }
1241 }
1242 else {
1243 target._chunks = chunks;
1244 }
1245 this._copyCommonProps(target);
1246
1247 if (!ignoreIndices) {
1248 target._indices = this._cloneIndices();
1249 }
1250 target._updateGetRawIdx();
1251 return target;
1252 }
1253
1254 private _copyCommonProps(target: DataStore): void {
1255 target._count = this._count;

Callers 6

filterMethod · 0.95
selectRangeMethod · 0.95
mapMethod · 0.95
lttbDownSampleMethod · 0.95
minmaxDownSampleMethod · 0.95
downSampleMethod · 0.95

Calls 4

_copyCommonPropsMethod · 0.95
_cloneIndicesMethod · 0.95
_updateGetRawIdxMethod · 0.95
cloneChunkFunction · 0.85

Tested by

no test coverage detected