@chrismg/n_closest_points

A simple npm package to find n closest points from an array of co-ordinates.

Usage no npm install needed!

<script type="module">
  import chrismgNClosestPoints from 'https://cdn.skypack.dev/@chrismg/n_closest_points';
</script>

README

@chrismg/n_closest_points

A simple npm package to find n closest points from an array of co-ordinates.

Install

$ npm install @chrismg/n_closest_points

Usage

const ncp = require('@chrismg/n_closest_points');

var array = [[25,90],[10,90], [5, 50]];
var n = 2;

var closest points = ncp.n_closest_points(array, n);