MCPcopy Create free account
hub / github.com/d3/d3-shape / normalizePath

Function normalizePath

test/asserts.js:9–11  ·  view source on GitHub ↗
(path)

Source from the content-addressed store, hash-verified

7const reNumber = /[-+]?(?:\d+\.\d+|\d+\.|\.\d+|\d+)(?:[eE][-]?\d+)?/g;
8
9function normalizePath(path) {
10 return path.replace(reNumber, formatNumber);
11}
12
13function formatNumber(s) {
14 return Math.abs((s = +s) - Math.round(s)) < 1e-6 ? Math.round(s) : s.toFixed(3);

Callers 1

assertPathEqualFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…