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

@bangron-work/cartless

v1.0.1

Published

Lightweight shopping cart library with weight, shipping, tax, and DOM binding

Downloads

182

Readme

🛒 Cartless (@bangron-work/cartless)

npm license size

Cartless adalah library JavaScript ringan untuk membuat keranjang belanja (shopping cart) tanpa backend, tanpa framework berat, dan tanpa ribet.

Cocok untuk:

  • Toko online sederhana
  • MVP / prototype
  • Landing page jualan
  • Integrasi custom checkout (API / WhatsApp / payment gateway)

⚡ Fokus: ringan, modular, dan mudah diintegrasikan.


✨ Fitur Utama

  • ➕ Add / update / remove item
  • 🔢 Quantity & stok maksimum
  • 💰 Subtotal & total
  • ⚖️ Total berat cart (siap ongkir / RajaOngkir)
  • 🚚 Ongkir dinamis
  • 🧾 Pajak
  • 🎟️ Voucher / diskon
  • 🔢 Unique code pembayaran
  • 💾 Persist cart (LocalStorage)
  • 🔔 Event system
  • 🧩 Auto DOM binding (opsional)

📦 Instalasi

Via CDN

<script src="https://unpkg.com/@bangron-work/cartless"></script>

Global object tersedia:

window.Cartless;

Via NPM

npm install @bangron-work/cartless
import Cartless from "@bangron-work/cartless";

🚀 Quick Start

HTML

<div class="cartless-item" data-id="P001" data-weight="500">
  <h4 class="item_name">Kaos Polos</h4>
  <b class="item_price">75000</b>
  <input class="item_qty" type="number" value="1" />
  <button class="item_add">Tambah</button>
</div>

<p>Total: <b data-cartless-total></b></p>
<p>Berat: <b data-cartless-weight data-unit="kg"></b> kg</p>

JavaScript

Cartless.config({
  tax: { enabled: true, rate: 11 },
  shipping: { enabled: true },
  features: {
    uniqueNumber: { enabled: true, digits: 3 },
  },
});

Cartless.DOM.init();

// Ongkir contoh: 10.000 per kg
Cartless.on("cart:change", () => {
  const kg = Cartless.weight() / 1000;
  Cartless.setShipping(Math.ceil(kg) * 10000);
});

🧩 DOM Auto Binding

Gunakan atribut berikut untuk update otomatis:

| Atribut | Keterangan | | ------------------------ | ----------- | | data-cartless-total | Total bayar | | data-cartless-subtotal | Subtotal | | data-cartless-tax | Pajak | | data-cartless-shipping | Ongkir | | data-cartless-weight | Total berat | | data-cartless-items | Jumlah item |

Contoh:

<span data-cartless-total></span>
<span data-cartless-weight data-unit="kg"></span>

⚙️ Konfigurasi

Cartless.config({
  currency: {
    symbol: "Rp",
    decimals: 0,
  },
  tax: {
    enabled: true,
    rate: 11,
  },
  shipping: {
    enabled: true,
  },
  features: {
    uniqueNumber: {
      enabled: true,
      digits: 3,
    },
  },
});

📦 Produk & Berat

<div
  class="cartless-item"
  data-id="SKU01"
  data-weight="1200"
  data-stock="10"
></div>

Berat menggunakan gram.

Total berat:

Cartless.weight(); // gram

🎟️ Voucher

Cartless.applyVoucher({
  type: "percentage", // atau 'fixed'
  value: 10,
  max: 50000,
});

🧾 Checkout

const payload = Cartless.checkout(
  {
    name: "Budi",
    phone: "08123xxxx",
  },
  { mode: "full" }
);

console.log(payload);

🔔 Event Listeners

Cartless.on("cart:add", (items) => {});
Cartless.on("cart:update", (items) => {});
Cartless.on("cart:remove", (items) => {});
Cartless.on("cart:change", (pricing) => {});
Cartless.on("shipping:change", (cost) => {});

Wildcard:

Cartless.on("*", (event, data) => {});

🧹 Clear Cart

Cartless.clear();

🧠 Arsitektur Singkat

  • cart.js → state & kalkulasi
  • dom.js → DOM binding (opsional)
  • events.js → event bus
  • core.js → config, currency, tax
  • index.js → public API

Tidak ada circular dependency ✔


📜 Lisensi

MIT License


⭐ Penutup

Cartless dibuat untuk developer yang ingin:

  • cepat
  • bersih
  • fleksibel

Tanpa framework berat.

🚀 Selamat membangun toko online!