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

@getexeer/saudi-eosb

v1.0.1

Published

Saudi end-of-service benefits under Articles 84 and 85 of the Saudi Labour Law: base award, resignation fractions and length of service. Zero dependencies, works in Node and the browser.

Downloads

326

Readme

saudi-eosb

End-of-service benefits for Saudi Arabia — مكافأة نهاية الخدمة — under Articles 84 and 85 of the Saudi Labour Law.

Zero dependencies. No build step. Runs in Node 18+ and in the browser.

import { calculateEosb, REASON } from "@getexeer/saudi-eosb";

calculateEosb({ wage: 5000, years: 7, reason: REASON.RESIGNATION }).amount;
// 15000

What it implements

Article 84 — the base award. Half a month's wage for each of the first five years of service, and one full month's wage for each year after that, calculated on the last wage.

Article 85 — what resignation actually pays. The base award is reduced on resignation:

| Length of service | Entitlement | | --- | --- | | Under 2 years | None | | 2 to under 5 years | One third of the base award | | 5 to under 10 years | Two thirds of the base award | | 10 years or more | The full base award |

Termination by the employer pays the full base award.

Install

npm install @getexeer/saudi-eosb

Usage

From a length of service you already have

import { calculateEosb, REASON } from "@getexeer/saudi-eosb";

const result = calculateEosb({
  wage: 9000,                     // last monthly wage, in SAR
  years: 6.5,                     // decimal years of service
  reason: REASON.TERMINATION,     // or REASON.RESIGNATION
});

result.amount;      // 58500  — the settlement
result.baseAmount;  // 58500  — Article 84 award before the Article 85 fraction
result.baseMonths;  // 6.5    — months of wage
result.factor;      // 1

From two dates

const result = calculateEosb({
  wage: 7500,
  startDate: "2018-03-01",
  endDate: "2026-09-01",
  reason: REASON.RESIGNATION,
});

result.years;            // 8.50…  decimal years used in the calculation
result.service.wholeYears; // 8
result.service.months;     // 6
result.service.days;       // 0
result.amount;             // two thirds of the base award

The pieces on their own

import { baseAward, resignationFactor, serviceLength } from "@getexeer/saudi-eosb";

baseAward({ wage: 5000, years: 10 });
// { firstYears: 5, laterYears: 5, baseMonths: 7.5, amount: 37500 }

resignationFactor(7);
// { factor: 0.666…, label: "Two thirds (5 to under 10 years)", labelAr: "ثلثا المكافأة (5 إلى أقل من 10)" }

serviceLength("2020-01-01", "2023-07-01");
// { totalDays: 1277, years: 3.49…, wholeYears: 3, months: 5, days: 27 }

What this library does not decide

These turn on facts and written procedures rather than arithmetic, so they are left to a human to review. They are named here so nobody assumes the function has already handled them:

  • Dismissal for a valid reason under Article 80 — no award is due, and the employer must have followed the investigation procedure the article requires.
  • Leaving for a lawful reason under Article 81.
  • The full-award cases under Article 87 — for example a woman resigning within six months of marriage or three months of childbirth.

Accuracy notes

  • Service length is counted at 365.25 days per year, so leap years do not drift the total.
  • Amounts are rounded to two decimals.
  • Article 84 names the last wage as the basis, so pass the final monthly wage, not an average.
  • The library throws on a negative wage, a negative length of service, an unparseable date, or an unknown reason. It does not return NaN quietly.

TypeScript

Types ship with the package. calculateEosb returns a frozen EosbResult; REASON is a frozen const object, so reason is narrowed rather than a bare string.

Not legal advice

This is an arithmetic library. It encodes a reading of Articles 84 and 85 and nothing more. Verify any figure that will actually be paid, and consult a qualified professional on contested cases. Applicable rules and their interpretation can change.

About

This is the calculation behind the free end-of-service calculator published by Exeer (إكسير), a Saudi administrative and HR system. It is packaged here so that anyone building payroll or HR software for Saudi businesses can reuse the same rules instead of re-deriving them.

License

MIT © Exeer