npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@hugojosefson/openmeal-api

v4.0.0

Published

API module for accessing school lunch menus from skolmaten.se

Downloads

19

Readme

API for Open Meal Information

Build Status npm page License ISC SemVer 2.0.0 JavaScript Style Guide

Introduction

This is an unofficial API module for accessing Swedish school lunch menus from skolmaten.se via Open Meal Information as specified at https://orebrokommun.github.io/Open-Meal-Information/.

Prerequisite

Node.js, at least v10.13.0.

Recommended to install latest via nvm:

nvm install stable

Installation in a project

yarn add @hugojosefson/openmeal-api
 # or
npm install --save @hugojosefson/openmeal-api

Programmatic access

It is recommended to import or require the module, and use its exported functions programmatically.

API

Table of Contents

getDataProviders

Returns data providers.

Parameters

Returns Promise A Promise of the data property of the response from the server.

getDataProviderSkolmaten

Returns the data provider with name === 'Skolmaten'.

Parameters

Returns Promise A Promise of the data property of the response from the server.

getDistributors

Returns distributors from a data provider.

Parameters
  • dataprovider object data provider object to fetch distributors from.
    • dataprovider.baseUrl string baseUrl of the data provider.

Returns Promise A Promise of the data property of the response from the server.

filterDistributors

Filters distributors based on partial name and/or partial address.

Parameters
  • options object
    • options.distributors Array current distributors to filter, for example from getDistributors or the result of previous call to this function.
    • options.name (string | undefined) if specified, only include distributors in result which contain this string in their name, case insensitively.
    • options.address (string | undefined) if specified, only include distributors in result which contain this string in their addressRegion or addressLocality, case insensitively.

Returns Promise<Array> A Promise of an array of distributors matching the criteria.

getMeals

Fetches meals for a distributor.

Parameters
  • options object
    • options.dataprovider object data provider object to fetch distributors from.
      • options.dataprovider.baseUrl string baseUrl of the data provider.
    • options.distributor object distributor whose meals to fetch.
      • options.distributor.distributorID string the distributor's ID.
    • options.startDate (string | undefined) start date on the form YYYY-MM-DD.
    • options.endDate (string | undefined) end date on the form YYYY-MM-DD.

Returns Promise A Promise of the data property of the response from the server.

extractOnlyMeals

Extracts an array of only meals objects from a response from getMeals().

Parameters
  • response object response from calling getMeals().

Returns Promise<Array> A Promise of an array containing all meal objects from the supplied response.

Usage on CLI

You can also try it from the command-line.

./node_modules/.bin/openmeal-api

Prints usage information for the CLI.