
Security News
Crates.io Users Targeted by Phishing Emails
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
@geoapify/un-locode
Advanced tools
A Node.js library for querying United Nations Location Code (UN/LOCODE) data
A Node.js library for querying United Nations Location Code (UN/LOCODE) data. This library provides easy access to UN/LOCODE data, allowing users to retrieve location details using country and location codes.
Install the package via npm:
npm install @geoapify/un-locode
Import the query
function from the package. Use the function with await
to fetch location details by specifying the country code and location code.
const { query } = require('@geoapify/un-locode');
(async () => {
try {
const result = query('US', 'APG');
console.log(result);
} catch (error) {
console.error('Error fetching location data:', error);
}
})();
US
for the United States.APG
for Aberdeen.The query
function returns a Promise resolving to an object with location data. If the specified code is not found, it returns null
. Example response:
{
"country": "US",
"location": "APG",
"locationName": "Aberdeen",
"subdivision": "MD",
"status": "AI",
"functionCodes": ["3", "4"],
"coordinates": {
"lat": 39.5120347,
"lon": -76.1643289
}
}
lat
(latitude) and lon
(longitude) for geographic coordinates.Note: Some rows in the original UN/LOCODE data lack coordinates. We used the Geoapify Geocoding API to find corresponding coordinates for these entries.
Each defined function has a classifier; the most important are:
The status of the entry is indicated by a 2-character code, with the following codes currently in use:
The function returns null
if the location is not found. Ensure your application handles this scenario accordingly.
Contributions are welcome! Please fork the repository, make your changes, and submit a pull request.
FAQs
A Node.js library for querying United Nations Location Code (UN/LOCODE) data
We found that @geoapify/un-locode demonstrated a healthy version release cadence and project activity because the last version was released less than 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
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
Product
Socket now lets you customize pull request alert headers, helping security teams share clear guidance right in PRs to speed reviews and reduce back-and-forth.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.