osm2geojson-ultra
Version:
a faster & more complete OSM & Overpass (either in xml or in json formats) to geojson convertor - 4x faster than xmldom + osmtogeojson in most situations - implemented in TypeScript with txml for XML parsing
21 lines (20 loc) • 514 B
JavaScript
export class LateBinder {
constructor(container, valueFunc, ctx, args) {
this.container = container;
this.valueFunc = valueFunc;
this.ctx = ctx;
this.args = args;
}
bind() {
const v = this.valueFunc.apply(this.ctx, this.args);
const idx = this.container.indexOf(this);
if (idx < 0) {
return;
}
const args = [idx, 1];
if (v) {
args.push(v);
}
this.container.splice(...args);
}
}