(
store: DataValueChunk[],
dimIdx: number,
dimType: DataStoreDimensionType,
end: number,
append?: boolean
)
| 130 | } |
| 131 | |
| 132 | function prepareStore( |
| 133 | store: DataValueChunk[], |
| 134 | dimIdx: number, |
| 135 | dimType: DataStoreDimensionType, |
| 136 | end: number, |
| 137 | append?: boolean |
| 138 | ): void { |
| 139 | const DataCtor = dataCtors[dimType || 'float']; |
| 140 | |
| 141 | if (append) { |
| 142 | const oldStore = store[dimIdx]; |
| 143 | const oldLen = oldStore && oldStore.length; |
| 144 | if (!(oldLen === end)) { |
| 145 | const newStore = new DataCtor(end); |
| 146 | // The cost of the copy is probably inconsiderable |
| 147 | // within the initial chunkSize. |
| 148 | for (let j = 0; j < oldLen; j++) { |
| 149 | newStore[j] = oldStore[j]; |
| 150 | } |
| 151 | store[dimIdx] = newStore; |
| 152 | } |
| 153 | } |
| 154 | else { |
| 155 | store[dimIdx] = new DataCtor(end); |
| 156 | } |
| 157 | }; |
| 158 | |
| 159 | /** |
| 160 | * Basically, DataStore API keep immutable. |
no outgoing calls
no test coverage detected
searching dependent graphs…