New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

mcdonald-location-apiv2

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mcdonald-location-apiv2

A Node.js library to programmatically find the nearest McDonald's locations and perform searches on the McDonald's site.

  • 1.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
decreased by-60%
Maintainers
1
Weekly downloads
 
Created
Source

mcdonald-location-apiv2

Description

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.

Features

  • Retrieve the nearest McDonald's location based on latitude and longitude.
  • Get a list of McDonald's locations within a specified radius.
  • Filter search results by a maximum number of results.

Installation

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.

Usage

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));

API Reference

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.

Feature: Search McDonald's Site

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.

Function: searchMcDonaldsSite(searchText, resultLimit)

Parameters:
  • 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.
Returns:
  • A promise that resolves to an array containing the titles of search results. The size of the array is determined by resultLimit.
Usage Example:
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);
  });

Keywords

FAQs

Package last updated on 15 Feb 2024

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc