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

ambalabs

v0.1.1

Published

Small TypeScript/JavaScript library for masking sensitive data.

Downloads

201

Readme

AmbaLabs

ambalabs adalah library kecil TypeScript/JavaScript untuk menyamarkan data sensitif seperti email, nomor telepon, nama, nomor kartu, dan kata tertentu di dalam teks.

  • npm: ambalabs
  • GitHub: Arito8382/Pkg-AmbaLabs
  • Versi saat ini: 0.1.0
  • Runtime minimum: Node.js >= 18

Install

npm install ambalabs

Jika ingin mengunci ke versi awal:

npm install [email protected]

Import

Package ini dipublish sebagai ESM.

import {
  maskCard,
  maskCustom,
  maskEmail,
  maskName,
  maskPhone,
  maskText
} from "ambalabs";

Jika dipakai dari CommonJS, gunakan dynamic import:

const {
  maskCard,
  maskCustom,
  maskEmail,
  maskName,
  maskPhone,
  maskText
} = await import("ambalabs");

Fitur

  • maskCustom()
  • maskEmail()
  • maskPhone()
  • maskName()
  • maskCard()
  • maskText()

Contoh Penggunaan

import {
  maskCard,
  maskCustom,
  maskEmail,
  maskName,
  maskPhone,
  maskText
} from "ambalabs";

maskEmail("[email protected]");
// i***[email protected]

maskPhone("081234567890");
// 0812****7890

maskPhone("+62 812-3456-7890");
// +62 81*-****-7890

maskCustom("ABCD1234", { preserveStart: 2, preserveEnd: 2 });
// AB****34

maskName("Intan Putri");
// I**** P****

maskCard("4111 1111 1111 1111");
// **** **** **** 1111

maskText("Nomor KTP Intan adalah 123456", ["Intan", "123456"]);
// Nomor KTP ***** adalah ******

API

maskCustom(value, options?)

Menyamarkan string apa pun dengan mempertahankan sebagian karakter awal dan akhir.

maskCustom("RAHASIA", { preserveStart: 1, preserveEnd: 1 });
// R*****A

Opsi:

  • preserveStart?: number jumlah karakter awal yang tetap terlihat.
  • preserveEnd?: number jumlah karakter akhir yang tetap terlihat.
  • maskChar?: string karakter masking. Jika lebih dari satu karakter, hanya karakter pertama yang dipakai.

maskEmail(email, options?)

Menyamarkan bagian local-part email. Domain tetap terlihat.

maskEmail("[email protected]");
// i***[email protected]

Opsi mengikuti maskCustom():

  • preserveStart?: number
  • preserveEnd?: number
  • maskChar?: string

maskPhone(phone, options?)

Menyamarkan digit tengah nomor telepon sambil mempertahankan format non-digit seperti spasi, +, atau -.

maskPhone("081234567890");
// 0812****7890

Opsi:

  • preserveStartDigits?: number default 4
  • preserveEndDigits?: number default 4
  • maskChar?: string

maskName(name, options?)

Menyamarkan setiap kata pada nama dengan mempertahankan huruf pertama tiap kata.

maskName("Intan Putri");
// I**** P****

Opsi:

  • maskChar?: string

maskCard(card, options?)

Menyamarkan digit nomor kartu dan mempertahankan 4 digit terakhir.

maskCard("4111 1111 1111 1111");
// **** **** **** 1111

Opsi:

  • preserveStartDigits?: number default 0
  • preserveEndDigits?: number default 4
  • maskChar?: string

maskText(text, terms, options?)

Menyamarkan kata atau frasa tertentu di dalam teks.

maskText("Email Intan adalah [email protected]", ["Intan", "[email protected]"]);
// Email ***** adalah *****************

Opsi:

  • caseSensitive?: boolean default false
  • wholeWord?: boolean default false
  • maskChar?: string

Perilaku Penting

  • Input null atau undefined akan menghasilkan string kosong.
  • maskPhone() dan maskCard() hanya menyamarkan digit, bukan separator.
  • maskText() menerima string tunggal atau array string.
  • Jika maskChar berisi lebih dari satu karakter, library hanya memakai karakter pertama.

TypeScript

Type definition sudah ikut dipublish. Tidak perlu install package tipe terpisah.

Development

npm install
npm run build
npm test

Validasi Package

npm run check

Perintah ini akan:

  • build TypeScript ke dist/
  • menjalankan test
  • menjalankan npm pack --dry-run

Publish

Publish package dilakukan dengan:

npm publish --access public

Untuk publish lewat GitHub Actions, repository membutuhkan secret NPM_TOKEN.