Skip to content

Commit

Permalink
let/const
Browse files Browse the repository at this point in the history
(see also #212)
  • Loading branch information
Fil committed Sep 19, 2021
1 parent 0372369 commit 5b706cf
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions src/log.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ function reflect(f) {
}

export function loggish(transform) {
let scale = transform(transformLog, transformExp),
domain = scale.domain,
base = 10,
logs,
pows;
const scale = transform(transformLog, transformExp);
const domain = scale.domain;
let base = 10;
let logs;
let pows;

function rescale() {
logs = logp(base), pows = powp(base);
Expand All @@ -72,19 +72,19 @@ export function loggish(transform) {
};

scale.ticks = count => {
let d = domain(),
u = d[0],
v = d[d.length - 1],
r = v < u;
const d = domain();
let u = d[0];
let v = d[d.length - 1];
const r = v < u;

if (r) ([u, v] = [v, u]);

let i = logs(u),
j = logs(v),
k,
t,
n = count == null ? 10 : +count,
z = [];
let i = logs(u);
let j = logs(v);
let k;
let t;
const n = count == null ? 10 : +count;
let z = [];

if (!(base % 1) && j - i < n) {
i = Math.floor(i), j = Math.ceil(j);
Expand Down Expand Up @@ -116,7 +116,7 @@ export function loggish(transform) {
if (typeof specifier !== "function") specifier = format(specifier);
if (count === Infinity) return specifier;
if (count == null) count = 10;
let k = Math.max(1, base * count / scale.ticks().length); // TODO fast estimate?
const k = Math.max(1, base * count / scale.ticks().length); // TODO fast estimate?
return d => {
let i = d / pows(Math.round(logs(d)), 1);
if (i * base < base - 0.5) i *= base;
Expand Down

0 comments on commit 5b706cf

Please sign in to comment.