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

b3dev-tp_api

v1.0.0

Published

My digital school - TP API

Downloads

8

Readme

TP Node.js

My digital school - TP API

Description

Ce TP a pour objectif de se familiariser avec Node.js et ses fonctionnalités principales :

  • Création de scripts Node.js
  • Utilisation de variables et arguments (process.argv)
  • Création de fonctions modulaires
  • Gestion de modules externes
  • Interaction utilisateur avec le module readline

Le projet consiste à développer un Distributeur Automatique de Billets (DAB) capable de calculer la répartition d’un montant donné en différentes coupures (billets et pièces) selon la devise choisie.

🗂 Structure du projet

.
├── app.js # Script principal
├── dab.js # Module de calcul des coupures
└── .vscode/
└── launch.json # Config VSCode pour le débogage

🚀 Installation et exécution

  1. Cloner le projet :
git clone <url-du-projet>
cd <nom-du-dossier>
  1. Vérifier que Node.js est installé :
node -v
  1. Exécuter le script :
node app.js

Fonctionnalités

Premier script

Affiche un prénom :

node app.js

Variables d’environnement

Permet de passer un prénom en paramètre :

node app.js Gabriel

DAB – Calcul des billets et pièces

Montant ≤ 200€

Billets : 50€, 20€, 10€, 5€

Pièces : 2€, 1€

DAB2 – Gestion via un tableau de coupures

Utilise une boucle pour toutes les coupures

Code plus court et modulable

DAB3/DAB4 – Fonctions génériques

determineCoupureGeneric({ montant: 137, typeDevise: "€" })

Gère différentes devises (Euro, Dollar)

Paramètre sous forme d’objet → facile à étendre

DAB5 – Module externe

determineCoupureGeneric dans dab.js

Import dans app.js :

const { determineCoupureGeneric } = require('./dab');

DAB6 – Interaction utilisateur

Utilise readline pour demander le montant et la devise Exemple d’exécution :

Montant : 137
Devise (€/$) : €
Résultat : { '50 euro': 2, '20 euro': 1, '10 euro': 1, '5 euro': 1, '2 euro': 1, '1 euro': 0 }

DAB7 – ESModule

Convertissez le projet en ESModules (import / export) en ajoutant "type": "module" dans le package.json. Utilisez maintenant top-level await pour rendre les questions plus lisibles avec le module :

import readline from 'node:readline/promises';

Exemple minimal :

const montant = await rl.question('Montant : ');
const devise = await rl.question('Devise : ');