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

miraath-calculator

v1.0.0

Published

🧮 Islamic inheritance calculator based on Quranic shares (علم المواريث) — حساب أنصبة الميراث الشرعية حسب القرآن. Part of Adwatak (adwatak.cloud).

Readme

miraath-calculator 🧮

Islamic inheritance calculator based on Quranic shares. حاسبة أنصبة الميراث الشرعية حسب سورة النساء.

🔗 Live demo: adwatak.cloud/tools/inheritance-calculator 🏠 Platform: Adwatak — free online Arabic tools (80+ tools)


Features

  • 16 heir types: husband, wives, sons, daughters, father, mother, grandparents, full/paternal/maternal siblings
  • Quranic fixed shares (أصحاب الفروض) — ½, ¼, ⅛, ⅙, ⅓, ⅔
  • Asabah (العصبة) — remainder distribution with male:female 2:1 ratio
  • Awl (العول) — proportional reduction when shares exceed the estate
  • Radd (الرد) — surplus return to Quranic heirs (excluding spouse)
  • Pure TypeScript — zero dependencies, works in Node, browser, React, etc.
  • Arabic & English output names
  • No API calls — all logic runs locally

Install

npm install miraath-calculator

Quick start

import { getDefaultHeirs, calculateInheritance } from 'miraath-calculator';

const heirs = getDefaultHeirs();
heirs.husband = true;
heirs.mother = true;
heirs.sons = 2;
heirs.daughters = 1;

const results = calculateInheritance(heirs, 500_000);

results.forEach(r => {
  console.log(`${r.icon} ${r.name}: ${r.percentage.toFixed(1)}% = ${r.amount.toFixed(0)} SAR`);
});
// 👨 الزوج: 25.0% = 125000 SAR
// 👩‍🦳 الأم: 12.5% = 62500 SAR
// 👦 الابن 1: 20.8% = 104167 SAR
// 👦 الابن 2: 20.8% = 104167 SAR
// 👧 البنت: 10.4% = 52083 SAR
// ...

API

getDefaultHeirs(): HeirSelection

Returns a fresh HeirSelection with all heirs deselected and counts set to 0.

calculateInheritance(heirs: HeirSelection, estateAmount: number): HeirResult[]

Calculates shares for the given heirs. Returns results sorted by share size (largest first).

Types

interface HeirSelection {
  husband: boolean;
  wife: boolean;
  wifeCount: number;       // 1–4
  sons: number;            // 0–20
  daughters: number;       // 0–20
  father: boolean;
  mother: boolean;
  grandfather: boolean;
  grandmotherPaternal: boolean;
  grandmotherMaternal: boolean;
  fullBrothers: number;
  fullSisters: number;
  paternalBrothers: number;
  paternalSisters: number;
  maternalBrothers: number;
  maternalSisters: number;
}

interface HeirResult {
  name: string;            // Arabic name
  nameEn: string;          // English name
  icon: string;            // Emoji icon
  share: number;           // Fraction of estate (0..1)
  amount: number;          // share * estateAmount
  percentage: number;      // share * 100
  color: string;           // Hex color for UI
  group: 'spouse' | 'parents' | 'children' | 'siblings' | 'asabah';
}

🕌 Islamic inheritance rules implemented

The calculation follows the Quranic rulings from Surah An-Nisa (النساء):

| Heir | Condition | Share | |------|-----------|-------| | Husband | No children | ½ | | Husband | With children | ¼ | | Wife(s) | No children | ¼ (divided equally) | | Wife(s) | With children | ⅛ (divided equally) | | Father | With children | ⅙ (+ asabah) | | Father | No children | Asabah (remainder) | | Mother | No children, <2 siblings | ⅓ | | Mother | With children or ≥2 siblings | ⅙ | | Daughter(s) | Only one, no son | ½ | | Daughters (2+) | No son | ⅔ (divided equally) | | Sons | — | Asabah (male gets 2x female) | | Full sister | One, no male blocker | ½ | | Full sisters (2+) | No male blocker | ⅔ | | Paternal sister | No full sister, no blocker | ½ | | Maternal sibling | No child/father/grandfather | ⅙ (capped at ⅓ total) |

Plus: Awl (proportional reduction), Radd (surplus return), and Hajb (blocking rules).


Browser usage (CDN)

<script type="module">
  import { calculateInheritance, getDefaultHeirs } from 'https://cdn.jsdelivr.net/npm/miraath-calculator/dist/index.js';

  const heirs = getDefaultHeirs();
  heirs.husband = true;
  heirs.mother = true;
  heirs.sons = 2;

  const result = calculateInheritance(heirs, 500000);
  console.log(result);
</script>

📜 License

MIT — Free to use, modify, and share.

Built by Adwatak — your free online tools platform in Arabic.
Explore 80+ tools at adwatak.cloud 🚀