RowsToFields: Fix issue with field names that are numbers (#40580)

* RowsToFields: Fix issue with field names that are numbers

* Only add the index accessor if field name does not conflict with it

* fix lint

Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
This commit is contained in:
Torkel Ödegaard
2021-10-19 07:27:24 +02:00
committed by GitHub
co-authored by Ryan McKinley
parent 7e59b92c8c
commit 25813db334
4 changed files with 44 additions and 5 deletions
@@ -32,10 +32,12 @@ export class DataFrameView<T = any> extends FunctionalVector<T> {
});
}
Object.defineProperty(obj, i, {
enumerable: false, // Don't enumerate array index
get: getter,
});
if (!(obj as any).hasOwnProperty(i.toString())) {
Object.defineProperty(obj, i, {
enumerable: false, // Don't enumerate array index
get: getter,
});
}
}
this.obj = obj;