You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
463 B
23 lines
463 B
import {map} from "./array"; |
|
import {linearish} from "./linear"; |
|
import number from "./number"; |
|
|
|
export default function identity() { |
|
var domain = [0, 1]; |
|
|
|
function scale(x) { |
|
return +x; |
|
} |
|
|
|
scale.invert = scale; |
|
|
|
scale.domain = scale.range = function(_) { |
|
return arguments.length ? (domain = map.call(_, number), scale) : domain.slice(); |
|
}; |
|
|
|
scale.copy = function() { |
|
return identity().domain(domain); |
|
}; |
|
|
|
return linearish(scale); |
|
}
|
|
|