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 🙏

© 2025 – Pkg Stats / Ryan Hefner

iem-quoteplayer-js

v8.5.0

Published

Une librairie TypeScript pour la gestion des tarifs

Readme

iem-quoteplayer-js

iem-quoteplayer-js est une librairie TypeScript permettant de gérer des grilles tarifaires complexes, de calculer des devis précis à partir de segments tarifaires, d'appliquer la TVA, des frais, et de générer des devis selon une durée ou un montant.


Sommaire


Installation

npm install iem-quoteplayer-js

Fonctionnalités

  • Définition de tables de segments tarifaires (linéaires ou forfaitaires)
  • Application de paramètres de calcul : TVA, frais fixes ou en pourcentage, arrondis, etc.
  • Génération dynamique de devis à partir d'une durée ou d'un montant
  • Détail des calculs (montants, TVA, frais, etc.)
  • Métadonnées personnalisables pour chaque devis

Exemples d'utilisation

Initialisation à partir d'une durée

import { initFromDuration } from "iem-quoteplayer-js";

const quote = initFromDuration({
  startDate: "2024-06-01T12:00:00Z",
  table: [
    { a: 100, d: 3600, l: true, dt: "np" }, // 1h linéaire non-proratisé
    { a: 50, d: 1800, l: false, dt: "p" }, // 30min forfaitaire proratisé
  ],
  parameters: {
    durationStep: 60, // pas de 1 minute
    vat: 20, // TVA 20%
    fees: {
      minimumFee: 1, // frais minimum
      percentageFee: 2, // 2% de frais
      vatFee: 20, // TVA sur les frais
    },
  },
  metadata: {
    some: "informations",
  },
});

Calcul d'un devis

const result = quote(5400); // 1h30 (5400 secondes)
console.log(result);

Exemple de résultat :

{
  "StartDate": "2024-06-01T12:00:00Z",
  "EndDate": "2024-06-01T13:30:00Z",
  "Amount": 153,
  "Duration": 5400,
  "DurationDetails": { "np": 3600, "p": 1800, "f": 0 },
  "AmountDetails": [
    { "type": "COST", "amount": 127.5 },
    { "type": "COST_VAT", "amount": 25.5, "rate": 20 },
    { "type": "FEES", "amount": 2.55 },
    { "type": "FEES_VAT", "amount": 0.51, "rate": 20 }
  ],
  "IsValid": true,
  "IsLinear": true,
  "IsFree": false,
  "IsForfait": false,
  "Metadata": {
    "some": "informations",
    "color": "#008800"
  }
}

Développement

# Installer les dépendances
npm install

# Lancer les tests unitaires
npm test

# Vérifier le lint
npm run lint

# Générer le build
npm run build

Licence

MIT


N'hésitez pas à enrichir ce README avec d'autres exemples ou à consulter les tests unitaires pour des scénarios avancés.