
Security News
ESLint Adds Official Support for Linting HTML
ESLint now supports HTML linting with 48 new rules, expanding its language plugin system to cover more of the modern web development stack.
nearby-sort
Advanced tools
This is very small and lightweight library that is capable to sort the given array by provided location coordinates.
Install nearby-sort with npm
npm install nearby-sort // npm
yarn add nearby-sort // yarn
import nearbySort from 'nearby-sort'; // ES6
const nearbySort = require("nearby-sort"); // CommonJS
// User's location
const coordinates = {
lat: 31.442907,
long: 74.271519,
};
// Array need to be sorted
const arr = [
{
name: 'Kudos',
lat: 31.460443680085763,
long: 74.26974289747655,
},
{
name: 'Dr Hospital',
lat: 31.480616187193373,
long: 74.28008468009904,
},
{
name: 'Steak Studio',
lat: 31.446620698317826,
long: 74.2704643576623,
},
];
// Asc Sort
let ascSortedData = await nearbySort(coordinates, arr);
// Desc Sort
let descSortedData = await nearbySort(coordinates, arr, false);
git checkout -b my-new-feature
git commit -am 'Add some feature'
git push origin my-new-feature
nearby-sort © Yousuf
Authored and maintained by Yousuf Kalim.
GitHub @yousufkalim · LinkedIn @yousufkalim
FAQs
The library to sort array of objects by distance from a given point
We found that nearby-sort demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
ESLint now supports HTML linting with 48 new rules, expanding its language plugin system to cover more of the modern web development stack.
Security News
CISA is discontinuing official RSS support for KEV and cybersecurity alerts, shifting updates to email and social media, disrupting automation workflows.
Security News
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.