Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
A list of US ZIP codes and their geolocations
A list of United States ZIP Codes based on the US Census Bureau's ZIP Code Tabulation Areas (ZCTAs).
:information_desk_person: Before using ZIP codes, there's helpful points to know:
:package: This package:
uses ZIP Code Tabulation Areas (ZCTAs) : Some ZIP codes used by the USPS are not included, such as those with no or very few residential addresses.
uses the center of the ZCTA polygon : This keeps the package smaller, more performant, and simpler to use. ZIP codes aren't very good for geolocation anyway, so we chose to keep the amount of data loaded in memory to a minimum.
stays up-to-date with the Census Bureau's data : After new data is published, this package is updated soon. Unlike several other ZIP lists, this one purges outdated information.
Example: get the nearest ZIP to a geolocation
:information_source: If you need the nearest ZIPs for a geolocation, check out
geo2zip
. It is much faster than the demo below and uses this package.
const geolib = require("geolib");
const usZips = require("us-zips/array");
const somewhere = {
lat: 33.1234,
lng: -88.4321,
};
geolib.findNearest(somewhere, usZips);
//» { latitude: 33.088581, longitude: -88.556133, zipCode: "39341" }
The default export returns an object. The object's keys are each ZIP code and values are objects with latitude and longitude properties.
const usZips = require('us-zips')
console.log(usZips['54301'])
//» { latitude: 44.480778, longitude: -88.016063 }
// Shape
{
…
'54301': { latitude: 44.480778, longitude: -88.016063 }
…
}
const usZips = require('us-zips/array')
console.log(usZips.find(zip => zip.zipCode === '37214'))
//» { latitude: 36.162189, longitude: -86.670867, zipCode: '37214' }
// Shape
[
…
{
latitude: 36.162189,
longitude: -86.670867,
zipCode: '37214'
},
…
]
const usZips = require('us-zips/key-value')
console.log(usZips.find(([key, value]) => key === '10001'))
//» ['10001', { latitude: 40.750634, longitude: -73.997176 }]
// Shape
[
…
['10001', { latitude: 40.750634, longitude: -73.997176 }],
…
]
const usZips = require("us-zips/map");
console.log(usZips.get("90210"));
//» { latitude: 34.100517, longitude: -118.41463 }
With Yarn or npm installed, run:
yarn add us-zips@2022.09
# ...or, if using `npm`
npm install us-zips@2022.09
:information_source: NOTE: Due to ZIP codes always changing, this package uses calendar versioning (aka CalVer). This means each year will have a separate "major" version from npm and Yarn's perspective. However, breaking changes could occur on minor versions. We suggest pinning to the minor version you want to use (e.g. yarn add us-zips@2022.09
).
Data for ZIP codes and their geolocations was generated from this file, which can be downloaded from the US Census Bureau map data page.
blakek/geo2zip
- get the nearest zip code from a geolocationblakek/standardize-geolocation
- takes geolocations of different
formats and outputs a standardized versionMIT
FAQs
A list of US ZIP codes and their geolocations
The npm package us-zips receives a total of 5,572 weekly downloads. As such, us-zips popularity was classified as popular.
We found that us-zips 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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.