PHP 7.4.33
Preview: line.js Size: 1.69 KB
/var/www/sitesecurity.bitkit.dk/httpdocs/node_modules/d3-shape/src/line.js
import array from "./array.js";
import constant from "./constant.js";
import curveLinear from "./curve/linear.js";
import {withPath} from "./path.js";
import {x as pointX, y as pointY} from "./point.js";

export default function(x, y) {
  var defined = constant(true),
      context = null,
      curve = curveLinear,
      output = null,
      path = withPath(line);

  x = typeof x === "function" ? x : (x === undefined) ? pointX : constant(x);
  y = typeof y === "function" ? y : (y === undefined) ? pointY : constant(y);

  function line(data) {
    var i,
        n = (data = array(data)).length,
        d,
        defined0 = false,
        buffer;

    if (context == null) output = curve(buffer = path());

    for (i = 0; i <= n; ++i) {
      if (!(i < n && defined(d = data[i], i, data)) === defined0) {
        if (defined0 = !defined0) output.lineStart();
        else output.lineEnd();
      }
      if (defined0) output.point(+x(d, i, data), +y(d, i, data));
    }

    if (buffer) return output = null, buffer + "" || null;
  }

  line.x = function(_) {
    return arguments.length ? (x = typeof _ === "function" ? _ : constant(+_), line) : x;
  };

  line.y = function(_) {
    return arguments.length ? (y = typeof _ === "function" ? _ : constant(+_), line) : y;
  };

  line.defined = function(_) {
    return arguments.length ? (defined = typeof _ === "function" ? _ : constant(!!_), line) : defined;
  };

  line.curve = function(_) {
    return arguments.length ? (curve = _, context != null && (output = curve(context)), line) : curve;
  };

  line.context = function(_) {
    return arguments.length ? (_ == null ? context = output = null : output = curve(context = _), line) : context;
  };

  return line;
}

Directory Contents

Dirs: 4 × Files: 19
Name Size Perms Modified Actions
curve DIR
- drwxr-xr-x 2026-04-28 09:11:40
Edit Download
offset DIR
- drwxr-xr-x 2026-04-28 09:11:40
Edit Download
order DIR
- drwxr-xr-x 2026-04-28 09:11:40
Edit Download
symbol DIR
- drwxr-xr-x 2026-04-28 09:11:40
Edit Download
8.64 KB lrw-r--r-- 2026-04-28 09:11:39
Edit Download
3.14 KB lrw-r--r-- 2026-04-28 09:11:39
Edit Download
944 B lrw-r--r-- 2026-04-28 09:11:39
Edit Download
242 B lrw-r--r-- 2026-04-28 09:11:39
Edit Download
81 B lrw-r--r-- 2026-04-28 09:11:40
Edit Download
86 B lrw-r--r-- 2026-04-28 09:11:40
Edit Download
43 B lrw-r--r-- 2026-04-28 09:11:40
Edit Download
3.28 KB lrw-r--r-- 2026-04-28 09:11:40
Edit Download
1.69 KB lrw-r--r-- 2026-04-28 09:11:40
Edit Download
402 B lrw-r--r-- 2026-04-28 09:11:40
Edit Download
1.79 KB lrw-r--r-- 2026-04-28 09:11:40
Edit Download
492 B lrw-r--r-- 2026-04-28 09:11:40
Edit Download
29 B lrw-r--r-- 2026-04-28 09:11:40
Edit Download
393 B lrw-r--r-- 2026-04-28 09:11:40
Edit Download
2.34 KB lrw-r--r-- 2026-04-28 09:11:40
Edit Download
81 B lrw-r--r-- 2026-04-28 09:11:40
Edit Download
101 B lrw-r--r-- 2026-04-28 09:11:40
Edit Download
1.39 KB lrw-r--r-- 2026-04-28 09:11:40
Edit Download
1.80 KB lrw-r--r-- 2026-04-28 09:11:40
Edit Download
If ZipArchive is unavailable, a .tar will be created (no compression).