Skip to content

Commit be4cfe2

Browse files
committed
Add changeset (and remove extra/unused functions in pivot)
1 parent 7f6d6c4 commit be4cfe2

2 files changed

Lines changed: 5 additions & 16 deletions

File tree

.changeset/olive-elephants-rule.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"layerchart": patch
3+
---
4+
5+
Add pivotLonger() and pivotWider() to top-level exports. Add `layerchart/utils` export for additional utils

packages/layerchart/src/lib/utils/pivot.ts

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,5 @@
11
import { group } from 'd3-array';
22

3-
export function getAccessor(key: string) {
4-
if (typeof key === 'function') {
5-
return key;
6-
} else {
7-
return (d: any) => d[key];
8-
}
9-
}
10-
113
/**
124
* Pivot longer (columns to rows)
135
* - see: https://observablehq.com/d/3ea8d446f5ba96fe
@@ -34,11 +26,3 @@ export function pivotWider(data: any[], column: string, name: string, value: str
3426
Object.fromEntries([[column, columnVal]].concat(items.map((d) => [d[name], d[value]])))
3527
);
3628
}
37-
38-
export function first(items: any[]) {
39-
return items[0];
40-
}
41-
42-
export function last(items: any[]) {
43-
return items[items.length - 1];
44-
}

0 commit comments

Comments
 (0)