New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

vega-voronoi

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vega-voronoi - npm Package Compare versions

Comparing version 4.1.2 to 4.1.3

42

build/vega-voronoi.js
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vega-dataflow'), require('vega-util'), require('d3-delaunay')) :
typeof define === 'function' && define.amd ? define(['exports', 'vega-dataflow', 'vega-util', 'd3-delaunay'], factory) :
(global = global || self, factory((global.vega = global.vega || {}, global.vega.transforms = {}), global.vega, global.vega, global.d3));
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.vega = global.vega || {}, global.vega.transforms = {}), global.vega, global.vega, global.d3));
}(this, (function (exports, vegaDataflow, vegaUtil, d3Delaunay) { 'use strict';

@@ -25,30 +25,30 @@

const prototype = vegaUtil.inherits(Voronoi, vegaDataflow.Transform);
const defaultExtent = [-1e5, -1e5, 1e5, 1e5];
prototype.transform = function(_, pulse) {
const as = _.as || 'path',
data = pulse.source;
vegaUtil.inherits(Voronoi, vegaDataflow.Transform, {
transform(_, pulse) {
const as = _.as || 'path',
data = pulse.source;
// nothing to do if no data
if (!data || !data.length) return pulse;
// nothing to do if no data
if (!data || !data.length) return pulse;
// configure and construct voronoi diagram
let s = _.size;
s = s ? [0, 0, s[0], s[1]]
: (s = _.extent) ? [s[0][0], s[0][1], s[1][0], s[1][1]]
: defaultExtent;
// configure and construct voronoi diagram
let s = _.size;
s = s ? [0, 0, s[0], s[1]]
: (s = _.extent) ? [s[0][0], s[0][1], s[1][0], s[1][1]]
: defaultExtent;
const voronoi = this.value = d3Delaunay.Delaunay.from(data, _.x, _.y).voronoi(s);
const voronoi = this.value = d3Delaunay.Delaunay.from(data, _.x, _.y).voronoi(s);
// map polygons to paths
for (let i=0, n=data.length; i<n; ++i) {
const polygon = voronoi.cellPolygon(i);
data[i][as] = polygon ? toPathString(polygon) : null;
// map polygons to paths
for (let i=0, n=data.length; i<n; ++i) {
const polygon = voronoi.cellPolygon(i);
data[i][as] = polygon ? toPathString(polygon) : null;
}
return pulse.reflow(_.modified()).modifies(as);
}
});
return pulse.reflow(_.modified()).modifies(as);
};
// suppress duplicated end point vertices

@@ -55,0 +55,0 @@ function toPathString(p) {

@@ -1,1 +0,1 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vega-dataflow"),require("vega-util"),require("d3-delaunay")):"function"==typeof define&&define.amd?define(["exports","vega-dataflow","vega-util","d3-delaunay"],t):t(((e=e||self).vega=e.vega||{},e.vega.transforms={}),e.vega,e.vega,e.d3)}(this,(function(e,t,n,a){"use strict";function r(e){t.Transform.call(this,null,e)}r.Definition={type:"Voronoi",metadata:{modifies:!0},params:[{name:"x",type:"field",required:!0},{name:"y",type:"field",required:!0},{name:"size",type:"number",array:!0,length:2},{name:"extent",type:"array",array:!0,length:2,default:[[-1e5,-1e5],[1e5,1e5]],content:{type:"number",array:!0,length:2}},{name:"as",type:"string",default:"path"}]};const o=n.inherits(r,t.Transform),i=[-1e5,-1e5,1e5,1e5];function l(e){const t=e[0][0],n=e[0][1];let a=e.length-1;for(;e[a][0]===t&&e[a][1]===n;--a);return"M"+e.slice(0,a+1).join("L")+"Z"}o.transform=function(e,t){const n=e.as||"path",r=t.source;if(!r||!r.length)return t;let o=e.size;o=o?[0,0,o[0],o[1]]:(o=e.extent)?[o[0][0],o[0][1],o[1][0],o[1][1]]:i;const f=this.value=a.Delaunay.from(r,e.x,e.y).voronoi(o);for(let e=0,t=r.length;e<t;++e){const t=f.cellPolygon(e);r[e][n]=t?l(t):null}return t.reflow(e.modified()).modifies(n)},e.voronoi=r,Object.defineProperty(e,"__esModule",{value:!0})}));
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vega-dataflow"),require("vega-util"),require("d3-delaunay")):"function"==typeof define&&define.amd?define(["exports","vega-dataflow","vega-util","d3-delaunay"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).vega=e.vega||{},e.vega.transforms={}),e.vega,e.vega,e.d3)}(this,(function(e,t,n,a){"use strict";function o(e){t.Transform.call(this,null,e)}o.Definition={type:"Voronoi",metadata:{modifies:!0},params:[{name:"x",type:"field",required:!0},{name:"y",type:"field",required:!0},{name:"size",type:"number",array:!0,length:2},{name:"extent",type:"array",array:!0,length:2,default:[[-1e5,-1e5],[1e5,1e5]],content:{type:"number",array:!0,length:2}},{name:"as",type:"string",default:"path"}]};const r=[-1e5,-1e5,1e5,1e5];function i(e){const t=e[0][0],n=e[0][1];let a=e.length-1;for(;e[a][0]===t&&e[a][1]===n;--a);return"M"+e.slice(0,a+1).join("L")+"Z"}n.inherits(o,t.Transform,{transform(e,t){const n=e.as||"path",o=t.source;if(!o||!o.length)return t;let l=e.size;l=l?[0,0,l[0],l[1]]:(l=e.extent)?[l[0][0],l[0][1],l[1][0],l[1][1]]:r;const f=this.value=a.Delaunay.from(o,e.x,e.y).voronoi(l);for(let e=0,t=o.length;e<t;++e){const t=f.cellPolygon(e);o[e][n]=t?i(t):null}return t.reflow(e.modified()).modifies(n)}}),e.voronoi=o,Object.defineProperty(e,"__esModule",{value:!0})}));
{
"name": "vega-voronoi",
"version": "4.1.2",
"version": "4.1.3",
"description": "Voronoi diagram transform for Vega dataflows.",

@@ -25,5 +25,5 @@ "keywords": [

"dependencies": {
"d3-delaunay": "^5.2.1",
"vega-dataflow": "^5.5.1",
"vega-util": "^1.13.2"
"d3-delaunay": "^5.3.0",
"vega-dataflow": "^5.7.1",
"vega-util": "^1.15.0"
},

@@ -33,3 +33,3 @@ "devDependencies": {

},
"gitHead": "35e31c5c6b54db9dc3a577b5adad8d15ec274d32"
"gitHead": "28db83352e43e321dfe55fc5cb6489b211e45662"
}

@@ -23,30 +23,30 @@ import {Transform} from 'vega-dataflow';

const prototype = inherits(Voronoi, Transform);
const defaultExtent = [-1e5, -1e5, 1e5, 1e5];
prototype.transform = function(_, pulse) {
const as = _.as || 'path',
data = pulse.source;
inherits(Voronoi, Transform, {
transform(_, pulse) {
const as = _.as || 'path',
data = pulse.source;
// nothing to do if no data
if (!data || !data.length) return pulse;
// nothing to do if no data
if (!data || !data.length) return pulse;
// configure and construct voronoi diagram
let s = _.size;
s = s ? [0, 0, s[0], s[1]]
: (s = _.extent) ? [s[0][0], s[0][1], s[1][0], s[1][1]]
: defaultExtent;
// configure and construct voronoi diagram
let s = _.size;
s = s ? [0, 0, s[0], s[1]]
: (s = _.extent) ? [s[0][0], s[0][1], s[1][0], s[1][1]]
: defaultExtent;
const voronoi = this.value = Delaunay.from(data, _.x, _.y).voronoi(s);
const voronoi = this.value = Delaunay.from(data, _.x, _.y).voronoi(s);
// map polygons to paths
for (let i=0, n=data.length; i<n; ++i) {
const polygon = voronoi.cellPolygon(i);
data[i][as] = polygon ? toPathString(polygon) : null;
// map polygons to paths
for (let i=0, n=data.length; i<n; ++i) {
const polygon = voronoi.cellPolygon(i);
data[i][as] = polygon ? toPathString(polygon) : null;
}
return pulse.reflow(_.modified()).modifies(as);
}
});
return pulse.reflow(_.modified()).modifies(as);
};
// suppress duplicated end point vertices

@@ -53,0 +53,0 @@ function toPathString(p) {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc