Skip to content

Commit a3f2ada

Browse files
committed
add d3.geo.pipeline
1 parent 61c5a25 commit a3f2ada

4 files changed

Lines changed: 49 additions & 2 deletions

File tree

d3.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3291,6 +3291,28 @@
32913291
d3.geo.orthographic = d3_geo_azimuthal(function() {
32923292
return 1;
32933293
}, Math.asin);
3294+
d3.geo.pipeline = function() {
3295+
var pipes = [];
3296+
return {
3297+
source: function() {
3298+
pipes[0] = arguments;
3299+
return this;
3300+
},
3301+
pipe: function() {
3302+
pipes.push(arguments);
3303+
return this;
3304+
},
3305+
sink: function() {
3306+
var sink = arguments[0].apply(null, [].slice.call(arguments, 1)), pipe;
3307+
while (pipe = pipes.pop()) {
3308+
var args = [].slice.call(pipe, 1);
3309+
args.push(sink);
3310+
sink = pipe[0].apply(null, args);
3311+
}
3312+
return sink;
3313+
}
3314+
};
3315+
};
32943316
d3.geom = {};
32953317
function d3_geom_pointX(d) {
32963318
return d[0];

d3.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/geo/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ import "project";
66
import "clip-antimeridian";
77
import "equirectangular";
88
import "orthographic";
9+
import "pipeline";

src/geo/pipeline.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import "geo";
2+
3+
d3.geo.pipeline = function() {
4+
var pipes = [];
5+
return {
6+
source: function() {
7+
pipes[0] = arguments;
8+
return this;
9+
},
10+
pipe: function() {
11+
pipes.push(arguments);
12+
return this;
13+
},
14+
sink: function() {
15+
var sink = arguments[0].apply(null, [].slice.call(arguments, 1)), pipe;
16+
while (pipe = pipes.pop()) {
17+
var args = [].slice.call(pipe, 1);
18+
args.push(sink);
19+
sink = pipe[0].apply(null, args);
20+
}
21+
return sink;
22+
}
23+
};
24+
};

0 commit comments

Comments
 (0)