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

garment-aql-calculator

v1.0.1

Published

AQL (Acceptable Quality Limit) sampling calculator for garment industry QC. Implements ISO 2859-1 sample size code letters and accept/reject tables. Returns sample size and decision rules for critical, major, and minor defect classifications. Built and us

Readme

garment-aql-calculator

Powered by Scan ERP License: MIT

AQL (Acceptable Quality Limit) sampling calculator for garment industry quality control. Implements ISO 2859-1 — the universal standard for inspection by attributes used by every garment QC team globally.

Built and used in production by Scan ERP — a garment manufacturing ERP running on a 100+ machine CMT factory in Nepal. See the live AQL lookup tool →

Install

npm install garment-aql-calculator

Why this exists

Every garment factory QC team runs AQL sampling on every shipment. Existing tools (QIMA, HQTS, Tetra Inspection) are web-only — no programmatic library. This package fills that gap so ERP systems, QC apps, and custom dashboards can run AQL calculations natively.

Quick start

const { calculateAQL } = require('garment-aql-calculator');

const result = calculateAQL({
  lotSize: 2400,
  inspectionLevel: 'GII',
  aql: 2.5,
});

console.log(result);
// {
//   lotSize: 2400,
//   inspectionLevel: 'GII',
//   aql: 2.5,
//   codeLetter: 'K',
//   sampleSize: 125,
//   acceptNumber: 7,
//   rejectNumber: 8,
//   decision: [Function]
// }

// Use the decision function with actual defects found
console.log(result.decision(5));   // 'ACCEPT' (5 ≤ 7)
console.log(result.decision(8));   // 'REJECT' (8 ≥ 8)

Full garment inspection (critical + major + minor)

Standard garment QC runs three AQL sampling plans simultaneously. Use the convenience function:

const { calculateGarmentInspection } = require('garment-aql-calculator');

const inspection = calculateGarmentInspection({
  lotSize: 2400,
  inspectionLevel: 'GII',
  // Defaults — standard garment industry values
  criticalAQL: 0.65,
  majorAQL: 2.5,
  minorAQL: 4.0,
});

console.log('Critical:', inspection.critical.sampleSize, 'accept', inspection.critical.acceptNumber);
console.log('Major:',    inspection.major.sampleSize,    'accept', inspection.major.acceptNumber);
console.log('Minor:',    inspection.minor.sampleSize,    'accept', inspection.minor.acceptNumber);

API

calculateAQL({ lotSize, inspectionLevel, aql })

| Param | Type | Default | Notes | |-------|------|---------|-------| | lotSize | number | required | Total units in the production lot (≥ 2) | | inspectionLevel | string | 'GII' | One of S1, S2, S3, S4, GI, GII, GIII | | aql | number | 2.5 | One of 0.65, 1.0, 1.5, 2.5, 4.0, 6.5 |

Returns { codeLetter, sampleSize, acceptNumber, rejectNumber, decision }.

calculateGarmentInspection({ lotSize, inspectionLevel, criticalAQL, majorAQL, minorAQL })

Returns three AQL results — one for each defect tier.

getCodeLetter(lotSize, inspectionLevel)

Lower-level utility: returns just the ISO 2859 code letter.

ISO 2859 reference

| Inspection level | Use case | |------------------|----------| | GI | Lower-risk products, smaller sample | | GII | Default — most garment inspections | | GIII | Higher-risk products, larger sample | | S1, S2, S3, S4 | Special inspection levels for destructive or expensive testing |

| Garment defect tier | Standard AQL | |---------------------|--------------| | Critical (safety, regulatory) | 0.65 | | Major (workmanship affecting function) | 2.5 | | Minor (cosmetic only) | 4.0 |

Try Scan ERP

This calculator is free. The full ERP system that uses it daily — QR-based bundle tracking, automated piece-rate payments, live WIP dashboards, factory hardware integration — is at scanerp.pro.

License

MIT — © 2026 Santosh Rijal / Scan ERP

Related packages