Skip to content

Commit c70d9f4

Browse files
committed
fix: Allow TSV files to have column names matching Map instance methods
1 parent 6d7e972 commit c70d9f4

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/types/columns.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,14 @@ const columnMapAccessorProxy = {
1515
prop: symbol | string,
1616
receiver: ColumnsMap,
1717
) {
18-
// Map.size exists, so we need to shadow it with the column contents
19-
if (prop === 'size') return target.get('size')
18+
// Map instance methods/properties that could plasubily be column names:
19+
if (
20+
['clear', 'delete', 'entries', 'get', 'has', 'keys', 'set', 'values', 'size'].includes(
21+
prop as string,
22+
)
23+
) {
24+
return target.get(prop as string)
25+
}
2026
const value = Reflect.get(target, prop, receiver)
2127
if (typeof value === 'function') return value.bind(target)
2228
if (prop === Symbol.iterator) return target[Symbol.iterator].bind(target)

0 commit comments

Comments
 (0)