1.2.0 • Published 9 years ago

reorder-topojson v1.2.0

Weekly downloads
3
License
MIT
Repository
gitlab
Last release
9 years ago

reorder-topojson

Reorder the arcs in a topology.

Why?

You have some TopoJSON. You need the arcs to be in a particular order, perhaps so you can load the topology progressively.

How?

Install with npm i reorder-topojson, or grab it from unpkg.com. Then:

import { reorder } from 'reorder-topojson';

const ranges = reorder( topology, [ 'foo', 'bar', 'baz' ]);

console.log( ranges );
// { foo: [ a, b ], bar: [ c, d ], baz: [ e, f ] }

The topology is modified in place. As a side-effect, unused arcs will be pruned. The returned ranges object contains, for each object, an array containing the first and last arcs used – helpful if you need to slice up the arcs array for progressive loading.

License

MIT.

1.2.0

9 years ago

1.1.0

9 years ago

1.0.0

9 years ago