We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 9c4af05 commit 223f6a6Copy full SHA for 223f6a6
1 file changed
src/datamanager.js
@@ -205,14 +205,19 @@ export default class DataManager {
205
}
206
207
prepareRow(row, meta) {
208
- const baseRowCell = {
209
- rowIndex: meta.rowIndex,
210
- indent: meta.indent
211
- };
212
-
213
row = row
214
.map((cell, i) => this.prepareCell(cell, i))
215
- .map(cell => Object.assign({}, baseRowCell, cell));
+ .map(cell => {
+ // Following code is equivalent but avoids memory allocation and copying.
+ // return Object.assign({rowIndex: meta.rowIndex, indent: meta.indent}, cell)
+ if (cell.rowIndex == null) {
+ cell.rowIndex = meta.rowIndex;
+ }
216
+ if (cell.indent == null) {
217
+ cell.indent = meta.indent;
218
219
+ return cell;
220
+ });
221
222
// monkey patched in array object
223
row.meta = meta;
0 commit comments