|
Last change
on this file since e4c61dd was e4c61dd, checked in by istevanoska <ilinastevanoska@…>, 6 months ago |
|
Prototype 1.1
|
-
Property mode
set to
100644
|
|
File size:
393 bytes
|
| Line | |
|---|
| 1 | import {Path} from "d3-path";
|
|---|
| 2 |
|
|---|
| 3 | export function withPath(shape) {
|
|---|
| 4 | let digits = 3;
|
|---|
| 5 |
|
|---|
| 6 | shape.digits = function(_) {
|
|---|
| 7 | if (!arguments.length) return digits;
|
|---|
| 8 | if (_ == null) {
|
|---|
| 9 | digits = null;
|
|---|
| 10 | } else {
|
|---|
| 11 | const d = Math.floor(_);
|
|---|
| 12 | if (!(d >= 0)) throw new RangeError(`invalid digits: ${_}`);
|
|---|
| 13 | digits = d;
|
|---|
| 14 | }
|
|---|
| 15 | return shape;
|
|---|
| 16 | };
|
|---|
| 17 |
|
|---|
| 18 | return () => new Path(digits);
|
|---|
| 19 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.