File tree Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -24,8 +24,8 @@ export const zero = () => 0;
24
24
export const string = x => x == null ? x : `${ x } ` ;
25
25
export const number = x => x == null ? x : + x ;
26
26
export const boolean = x => x == null ? x : ! ! x ;
27
- export const first = d => d [ 0 ] ;
28
- export const second = d => d [ 1 ] ;
27
+ export const first = x => x ? x [ 0 ] : undefined ;
28
+ export const second = x => x ? x [ 1 ] : undefined ;
29
29
export const constant = x => ( ) => x ;
30
30
31
31
// Some channels may allow a string constant to be specified; to differentiate
Original file line number Diff line number Diff line change @@ -22,6 +22,10 @@ it("dot() has the expected defaults", () => {
22
22
assert . strictEqual ( dot . shapeRendering , undefined ) ;
23
23
} ) ;
24
24
25
+ it ( "dot accepts undefined data" , ( ) => {
26
+ Plot . dot ( { length : 1 } ) . initialize ( ) ;
27
+ } ) ;
28
+
25
29
it ( "dot(data, {r}) allows r to be a constant radius" , ( ) => {
26
30
const dot = Plot . dot ( undefined , { r : 42 } ) ;
27
31
assert . strictEqual ( dot . r , 42 ) ;
You can’t perform that action at this time.
0 commit comments