MCPcopy Create free account
hub / github.com/Khan/perseus / parseQueryString

Function parseQueryString

packages/perseus/src/util.ts:320–337  ·  view source on GitHub ↗

* Query String Parser * * Original from: * http://stackoverflow.com/questions/901115/get-querystring-values-in-javascript/2880929#2880929

(query: string)

Source from the content-addressed store, hash-verified

318 const scale = scaleFromExtent(range[i], boxSize);
319 const gridStep = gridStepFromTickStep(step[i], scale);
320 return gridStep;
321 });
322}
323
324function snapStepFromGridStep(gridStep: [number, number]): [number, number] {
325 return [gridStep[0] / 2, gridStep[1] / 2];
326}
327
328/**
329 * Given the tickStep and the graph's scale, find a
330 * grid step.
331 * Example:
332 * gridStepFromTickStep(200, 0.2) // returns 100
333 */
334function gridStepFromTickStep(
335 tickStep: number,
336 scale: number,
337): number | null | undefined {
338 const tickWidth = tickStep * scale;
339 const x = tickStep;
340 const y = Math.pow(10, Math.floor(Math.log(x) / Math.LN10));

Callers

nothing calls this directly

Calls 1

dFunction · 0.85

Tested by

no test coverage detected