@@ -7,13 +7,14 @@ const TypedArray = Object.getPrototypeOf(Uint8Array);
7
7
const objectToString = Object . prototype . toString ;
8
8
9
9
// This allows transforms to behave equivalently to channels.
10
- export function valueof ( data , value , type ) {
11
- const array = type === undefined ? Array : type ;
12
- return typeof value === "string" ? array . from ( data , field ( value ) )
13
- : typeof value === "function" ? array . from ( data , value )
14
- : typeof value === "number" || value instanceof Date ? array . from ( data , constant ( value ) )
15
- : value && typeof value . transform === "function" ? arrayify ( value . transform ( data ) , type )
16
- : arrayify ( value , type ) ; // preserve undefined type
10
+ export function valueof ( data , value , arrayType ) {
11
+ const array = arrayType === undefined ? Array : arrayType ;
12
+ const type = typeof value ;
13
+ return type === "string" ? array . from ( data , field ( value ) )
14
+ : type === "function" ? array . from ( data , value )
15
+ : type === "number" || value instanceof Date || type === "boolean" ? array . from ( data , constant ( value ) )
16
+ : value && typeof value . transform === "function" ? arrayify ( value . transform ( data ) , arrayType )
17
+ : arrayify ( value , arrayType ) ; // preserve undefined type
17
18
}
18
19
19
20
export const field = name => d => d [ name ] ;
0 commit comments