You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

stan-api

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

stan-api

Support non officiel de l'API du Service de Transport de l'Agglomération Nancéienne (STAN)

1.1.3
Source
npmnpm
Version published
Weekly downloads
2
-83.33%
Maintainers
1
Weekly downloads
 
Created
Source

Stan

Support non officiel de l'API du Service de Transport de l'Agglomération Nancéienne (STAN).

Ce module permet de récupérer:

  • les prochains passages
  • les lignes
  • les directions
  • les arrêts

Kind: global class

  • Stan
    • .getLignes()Promise.<Array.<Ligne>>
    • .getArrets(ligne)Promise.<Array.<Arret>>
    • .getProchainsPassages(arret)Promise.<Array.<Passage>>
    • .getDirections(ligne)Promise.<Array.<Direction>>
    • .getArretsDirection(direction)Promise.<Array.<Arret>>

Stan.getLignes() ⇒ Promise.<Array.<Ligne>>

Lister les lignes du réseau de transport

Kind: static method of Stan
Example

const { Stan } = require('stan-api')

Stan.getLignes().then(lignes => console.log(lignes))

Stan.getArrets(ligne) ⇒ Promise.<Array.<Arret>>

Liste des arrêts d'une ligne

NB: Un arret peut être commun à plusieurs lignes.

Kind: static method of Stan

ParamTypeDescription
ligneLigneLigne

Example

const { Stan } = require('stan-api')

const ligneT4 = {
  id: 2332,
  numlignepublic: 'T4',
  osmid: 'line:GST:4-97',
  libelle: 'Tempo 4 - Laxou CLB <> Houdemont Porte Sud'
}
Stan.getArrets(ligneT4).then(arrets => console.log(arrets))

Stan.getProchainsPassages(arret) ⇒ Promise.<Array.<Passage>>

Lister les prochains passages d'un arrêt avec le temps d'attente estimé. Il n'est pas nécessaire de préciser une ligne, on récupère alors tous les passages des lignes desservants l'arrêt

Kind: static method of Stan

ParamTypeDescription
arretArretArrêt

Example

const { Stan } = require('stan-api')

const arret = {
  ligne: {
    id: 2332,
    numlignepublic: 'T4',
    osmid: 'line:GST:4-97',
    libelle: 'Tempo 4 - Laxou CLB <> Houdemont Porte Sud'
  },
  libelle: 'Place Stanislas - Dom Calmet',
  osmid: 'stop_point:GST:SP:NYPCL1'
}
Stan.getProchainsPassages(arret).then(p => {
  console.log(`Liste des prochains passages de l'arrêt "${arret.libelle}" de la ligne ${arret.ligne.numlignepublic}:
${p.map(passage => `${passage.direction} - Temps d'attente: ${Math.trunc(passage.temps_min/60)}H${passage.temps_min%60}min`).join('\n')}`)
})
Exemple sortie:
Liste des prochains passages de l'arrêt "Place Stanislas - Dom Calmet" de la ligne T4:
Direction Houdemont Porte Sud - Temps d'attente: 0H1min
Direction Houdemont Porte Sud - Temps d'attente: 0H8min
Direction Laxou Champ-le-Boeuf - Temps d'attente: 0H1min
Direction Laxou Champ-le-Boeuf - Temps d'attente: 0H8min

Stan.getDirections(ligne) ⇒ Promise.<Array.<Direction>>

Lister les directions d'une ligne

Kind: static method of Stan

ParamTypeDescription
ligneLigneLigne

Example

const { Stan } = require('stan-api')

const ligneT4 = {
  id: 2332,
  numlignepublic: 'T4',
  osmid: 'line:GST:4-97',
  libelle: 'Tempo 4 - Laxou CLB <> Houdemont Porte Sud'
}
Stan.getDirections(ligneT4).then(directions => console.log(directions))

Stan.getArretsDirection(direction) ⇒ Promise.<Array.<Arret>>

Lister les arrêts sur le chemin d'une direction d'une ligne

Kind: static method of Stan

ParamTypeDescription
directionDirectionDirection d'une ligne

Keywords

API

FAQs

Package last updated on 28 Mar 2023

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