Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function domainCheck(type, domain, df) {
if (isLogarithmic(type)) {
// sum signs of domain values
// if all pos or all neg, abs(sum) === domain.length
var s = Math.abs(domain.reduce(function(s, v) {
return s + (v < 0 ? -1 : v > 0 ? 1 : 0);
}, 0));
if (s !== domain.length) {
df.warn('Log scale domain includes zero: ' + stringValue(domain));
}
}
return domain;
}
export function tickFormat(scale, count, specifier, formatType) {
var format = scale.tickFormat ? scale.tickFormat(count, specifier)
: specifier && formatType === Time ? timeFormat(specifier)
: specifier ? numberFormat(specifier)
: String;
if (isLogarithmic(scale.type)) {
var logfmt = variablePrecision(specifier);
format = scale.bins ? logfmt : filter(format, logfmt);
}
return format;
}