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

jstringify

v0.0.4

Published

Utilitas JSON.stringify() JavaScript

Readme

jstringify

jstringify adalah utilitas JSON.stringify() JavaScript. Mendukung tipe data primitif, tipe data kompleks seperti array, object, Map, dan Set, serta menangani referensi siklik secara otomatis.

Fitur

  1. Mendukung tipe data berikut:

    • null
    • string
    • number
    • boolean
    • bigint
    • Date
    • Symbol
    • function
    • Map
    • Set
    • Array
    • Object
  2. Penanganan siklus referensi: Jika terdapat referensi siklik pada object, nilai "[Circular]" akan dimasukkan.

  3. Indentasi fleksibel: Parameter space menentukan jumlah spasi untuk indentasi yang menyerupai format JSON. Jika space = 0, hasilnya akan dalam satu baris tanpa spasi tambahan.

  4. Konversi property kompleks:

    • Object diubah menjadi pasangan kunci-nilai.
    • Map diubah menjadi format {key:value}.
    • Set diubah menjadi format [value1,value2,...].

Instalasi

npm install jstringify

Penggunaan

import { jstringify } from 'jstringify';

const file = './data.json';

const obj = {
  name: 'Salman',
  timestamp: new Date(),
  largeNumber: 1234567890123456768n,
  symbolKey: Symbol('unique'),
  map: new Map([['key', 'value']]),
  set: new Set([1, 2, 3]),
  greet: () => 'Hello',
};

jstringify.writeFile(file, obj, 2);
console.log(jstringify.readFile(file));
console.log(jstringify(obj, 2));

const a = {};
const b = { a };
a.b = b;
console.log(jstringify(a, 2));

const data = { nama: 'Salman' };
const data2 = { negara: 'Indonesia' };
data.tempat_tinggal = data2;
console.log(jstringify(data, 2));

Catatan: Tidak mendukung property non-enumerable atau getter.

API

jstringify

Parameter

  • value (wajib):
    Nilai yang akan dibuat.
    Tipe: any.

  • space (opsional):
    Jumlah spasi untuk indentasi dalam format JSON-like. Nilai default adalah 0 (tidak ada indentasi).
    Tipe: number.

  • level (opsional):
    Tingkat indentasi saat ini. Nilai ini digunakan secara internal oleh fungsi rekursif. Default adalah 0.
    Tipe: number.

  • seen (opsional):
    Set yang melacak referensi object yang telah diproses untuk mendeteksi siklus. Default adalah Set kosong.
    Tipe: Set.

writeFile

Parameter

  • filePath (wajib): Lokasi file tempat data akan ditulis.
  • data (wajib): Object atau data yang akan ditulis ke file.
  • space (opsional): Jumlah spasi untuk indentasi dalam file JSON (default: 0).

readFile

Parameter

  • filePath (wajib): Lokasi file JSON yang akan dibaca.