
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
zipcode_distance
Advanced tools
zipcode-distance is an npm library for calculating the distance between two zip codes, determining proximity within a range, and retrieving additional zip code-related data. This library uses geolocation data to help developers work with zip code-based distances in various applications.
Install the package via npm:
npm install zipcode-distance
Import the library in your project and use the available functions as shown below.
const zipcodeDistance = require('zipcode-distance');
const distance = zipcodeDistance.getDistance(90210, 10001, 'miles');
console.log(`Distance: ${distance} miles`);
const isWithinRange = zipcodeDistance.isDistanceInRange(90210, 10001, 50, 'miles');
console.log(`Within range: ${isWithinRange}`);
const closestZip = zipcodeDistance.findClosestZip(90210);
console.log(`Closest Zip: ${closestZip}`);
const zipsInRange = zipcodeDistance.getZipCodesWithinRadius(90210, 100, 'miles');
console.log(`Zip Codes within 100 miles: ${zipsInRange}`);
const location = zipcodeDistance.getCityAndState(90210);
console.log(`City: ${location.city}, State: ${location.state}`);
const sortedZips = zipcodeDistance.sortZipsByProximity(90210, [10001, 30301, 33101]);
console.log(`Sorted Zip Codes by Proximity:`, sortedZips);
const zipsByState = zipcodeDistance.groupZipsByState();
console.log(`Zip Codes by State:`, zipsByState);
const zipsByCounty = zipcodeDistance.groupZipsByCounty();
console.log(`Zip Codes by County:`, zipsByCounty);
The library uses a JSON file (csvjson.json) that contains zip codes along with their corresponding latitude, longitude, city, state, and county information.
This project is licensed under the MIT License. See the LICENSE file for more details.
Contributions are welcome! Please open an issue or submit a pull request if you have improvements or new feature ideas.
Feel free to reach out if you encounter any issues or have questions about using the library.
FAQs
Finds the distance between two zipcodes
We found that zipcode_distance demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.