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 🙏

© 2026 – Pkg Stats / Ryan Hefner

emt-mad

v0.3.1

Published

API client for EMT Madrid web services

Readme

EMT Madrid for Node.js

 

emt-mad is an API client for easy access to the EMT Madrid open data services.

Example

var EmtMad = require('emt-mad');

emt = new EmtMad('idClient', 'passKey');
emt.busGetListLines().then(console.dir);

Implementation

This module exports a single class, EmtMad, that can be instantiated with a client ID and a pass key. This new instance can then be used to perform requests to the API.

All methods that perform requests return Bluebird promises.

new EmtMad(idClient, passKey)

Creates a new object that can perform requests to the EMT OpenData API using the given idClient and passKey as provided by EMT.

EmtMad#request(service, parameters)

Performs a request to the specified service sending the given parameters. This is the base method upon every other builds. It allows to perform low-level requests to the API, without any transformation of input or output, other than a bit of error handling. The returned promise will get the resultValue object as-is, with any errors thrown as exceptions.

Bus Services

EmtMad#busGetCalendar(dateBegin, dateEnd)

Gets a list of calendar items with some miscellaneous information about the day. dateBegin marks the start of this list and defaults to new Date(). dateEnd marks the end of the list and defaults to dateBegin.

See the CalendarItem type for more information.

EmtMad#busGetGroups(cultureInfo)

Gets a list of "bus groups" with an identifier and a short description. The cultureInfo parameter is supposed to select the language and defaults to EmtMad.CULTURE_EN. It currently does not seem to work at all. Possible values are:

  • EmtMad.CULTURE_EN: "EN", English. Default value.
  • EmtMad.CULTURE_ES: "ES", Spanish.

See the GroupItem type for more information.

EmtMad#busGetLinesList(lines, date)

Gets a list with all lines included on the lines parameters. If no lines are given, this method returns all available lines. The date parameter indicates the date for which line information is returned, and defaults to the current day.

See the LineItem type for more information.

Other Methods

TODO: Add all other methods

Data Types and Values

CalendarItem

  • date: A Moment object constructed from the response.

  • dayType: A string value that determines the type of day from the perspective of EMT bus operation. The following constans are available for easy usage:

    • EmtMad.DAYTYPE_WORK: Working day
    • EmtMad.DAYTYPE_HOLIDAY_EVE: The day before a holiday
    • EmtMad.DAYTYPE_HOLIDAY: Holiday
  • strike: (Speculative) Whether or not there is a strike programmed for the day, as a boolean. The value of this field is converted from the observed value of "N" meaning false, and anything else meaning true.

  • weather: Unchanged value from the API representing the expected weather. Note: The existence of this field is documented, but its values aren't, and I personally have not seen it anywhere. Expect it to be undefined most times.

  • minTemp, maxTemp: Minimum and maximum temperature expected for the day. Note: In every request I did, these values were returned as 0.

  • seasonTg, seasonTU, dayTypeLT, dayTypePF, dayTypeCO: Unchanged information that I really don't know how to interpret. Help would be appreciated. These fields are subject to change in the future as I decypher what they mean.

  • week, month, trimester, quarter, semester, year, dayOfWeek: Unchanged information returned from the API. These values technically serve little purpose, as they can be calculated from the date with little effort. The existence of these fields is subject to change in the future.

GroupItem

  • id: An integer representing identifier of the group. The observed values include only multiples of 100.
  • description: A string with a textual description of the group.

LineItem

  • id: An integer representing the identifier of the line.
  • label: The actual line name shown in every informational piece of information of the city. Usually a number, lettler, or a letter and a number.
  • group: An integer representing the group to which the line belongs. This group does not necessary matches a group from the GetGroups service.
  • nameA: The name of one of the line ends, named A.
  • nameB: The name of the other line end, named B.
  • dateFirst: The date at which this information became valid.
  • dateLast: Known date at which this information becomes invalid.