![require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages](https://cdn.sanity.io/images/cgdhsj6q/production/be8ab80c8efa5907bc341c6fefe9aa20d239d890-1600x1097.png?w=400&fit=max&auto=format)
Security News
require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
mcdonald-location-apiv2
Advanced tools
A Node.js library to programmatically find the nearest McDonald's locations and perform searches on the McDonald's site.
mcdonald-location-apiv2
is a Node.js package that provides an easy way to find McDonald's locations based on latitude and longitude. It supports finding the nearest location or retrieving a list of locations within a specified search radius. This API utilizes an unofficial McDonald's location API and offers additional functionality for filtering results. It also offers a feature to search the McDonald's site and fetch results, such as food items, articles, etc.
To install mcdonald-location-apiv2
, use npm:
npm i mcdonald-location-apiv2
This will download and install the package and all its dependencies in your project's node_modules directory.
After installation, you can use the package in your Node.js application to make API requests. Here is a basic example:
const mcdonaldsApi = require('mcdonald-location-apiv2');
// Example: Get the nearest McDonald's location
mcdonaldsApi.getNearestLocation(40.712776, -74.005974)
.then(location => console.log(location))
.catch(error => console.error(error));
// Example: Get a list of McDonald's locations within a 10km radius
mcdonaldsApi.getLocations(40.712776, -74.005974, 10)
.then(locations => console.log(locations))
.catch(error => console.error(error));
getNearestLocation(latitude, longitude)
Parameters:
latitude
: Latitude of the search location.longitude
: Longitude of the search location.Returns: A Promise that resolves to the nearest McDonald's location.
getLocations(latitude, longitude, radius, maxResults)
Parameters:
latitude
: Latitude of the search location.longitude
: Longitude of the search location.radius
: Optional. Search radius in kilometers. Defaults to 8.045 km.maxResults
: Optional. Maximum number of results to return. Defaults to 30.Returns: A Promise that resolves to an array of McDonald's locations within the specified radius.
This library includes a function, searchMcDonaldsSite
, that allows you to search the McDonald's website for specific content. You can specify a search query and an optional limit for the number of results returned.
searchMcDonaldsSite(searchText, resultLimit)
searchText
(String): The text string you want to search for on the McDonald's site.resultLimit
(Number, optional): The maximum number of search results to return. Defaults to 10 if not specified.resultLimit
.const { searchMcDonaldsSite } = require('your-package-name');
searchMcDonaldsSite('Big Mac', 5)
.then(results => {
console.log(results); // Returns up to 5 results
})
.catch(error => {
console.error(error);
});
FAQs
A Node.js library to programmatically find the nearest McDonald's locations and perform searches on the McDonald's site.
The npm package mcdonald-location-apiv2 receives a total of 2 weekly downloads. As such, mcdonald-location-apiv2 popularity was classified as not popular.
We found that mcdonald-location-apiv2 demonstrated a healthy version release cadence and project activity because the last version was released less than 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
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.