UNPKG

osm2geojson-lite

Version:

a lightweight yet faster osm (either in xml or in json formats) to geojson convertor - 4x faster than xmldom + osmtogeojson in most situations - implemented in pure JavaScript without any 3rd party dependency

25 lines (24 loc) 666 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.LateBinder = void 0; 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); } Array.prototype.splice.apply(this.container, args); } } exports.LateBinder = LateBinder;