Download node_modules/d3-array/src/nice.js from NKessler/Horizon: direct link, hf CLI and curl.
- Browser
- Download file 535 Bytes
-
https://huggingface.co/NKessler/Horizon/resolve/main/node_modules/d3-array/src/nice.js
- Command line
-
hf download hf://NKessler/Horizon/node_modules/d3-array/src/nice.js
-
curl -L -o nice.js https://huggingface.co/NKessler/Horizon/resolve/main/node_modules/d3-array/src/nice.js
535 Bytes
| import {tickIncrement} from "./ticks.js"; | |
| export default function nice(start, stop, count) { | |
| let prestep; | |
| while (true) { | |
| const step = tickIncrement(start, stop, count); | |
| if (step === prestep || step === 0 || !isFinite(step)) { | |
| return [start, stop]; | |
| } else if (step > 0) { | |
| start = Math.floor(start / step) * step; | |
| stop = Math.ceil(stop / step) * step; | |
| } else if (step < 0) { | |
| start = Math.ceil(start * step) / step; | |
| stop = Math.floor(stop * step) / step; | |
| } | |
| prestep = step; | |
| } | |
| } | |