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

@jodijonatan/jo-client

v2.1.4

Published

Premium TypeScript utility suite for LKS Web Technology with React Hooks support.

Readme


jo-client v2 didesain khusus bagi ekosistem React 19 + TypeScript. Pustaka ringan (zero-dependencies) ini akan memangkas puluhan jam pengembangan Anda dengan menyajikan Hooks yang kokoh untuk HTTP Requests, Autentikasi, Manajemen Form, dan Kerangka Game Canvas.

🌟 Fitur Utama

🔌 State-Driven HTTP Client (useLKSHttp)

Wrapper API (Fetch) yang langsung terikat pada lifecycle komponen React Anda. Status loading dan error ditangani sepenuhnya secara internal tanpa perlu banyak useState redundan. Bearer Token pun akan dipasangkan secara otomatis.

🛡️ Type-Safe Form Validator (useLKSValidator)

Sistem pemvalidasi form real-time berbasis Schema Object. Terlindungi secara ketat oleh tipe (strict-typing), mencegah komponen Anda crash karena tipe data tak terduga.

🔐 Global Auth Manager (useLKSAuth)

Kendali tunggal atas Status Login pengguna secara langsung melintasi seluruh komponen aplikasi Anda menggunakan sinkronisasi reaktif dari localStorage.

🎮 Canvas Game Helpers (LKSGame)

Karena LKS tidak pernah terlepas dari pembuatan mini-game, modul murni ini memfasilitasi algoritma dasar (contoh: AABB Collision Box dan Asset Preloader). Bebas overlap manipulasi DOM.


💻 Panduan Singkat

Eksekusi Query API Terlindungi (Protected Endpoint)

Hanya dalam beberapa baris kode, Anda memiliki sistem data-fetching yang elegan:

import { useEffect, useState } from 'react';
import { useLKSHttp } from '@jodijonatan/jo-client';

export function ProductList() {
  const { get, isLoading, error } = useLKSHttp("http://localhost:8000/api");
  const [products, setProducts] = useState([]);

  useEffect(() => {
    // Fungsi get() menyertakan Token secara otomatis!
    get("/products").then(response => {
      if (response) setProducts(response.data);
    });
  }, [get]);

  // Handle otomatis status fetching
  if (isLoading) return <p className="animate-pulse">Loading products...</p>;
  if (error) return <p className="text-red-500">Error: {error.message}</p>;

  return (
    <ul className="space-y-2">
      {products.map(p => <li key={p.id}>{p.name}</li>)}
    </ul>
  );
}

Registrasi Form Bebas-Ribet

Lacak validasi input tanpa if-else bertingkat:

import { useState } from 'react';
import { useLKSValidator } from '@jodijonatan/jo-client';

export function UserForm() {
  const [formData, setFormData] = useState({ email: '', age: '' });
  
  // Definisikan Skema secara dinamis
  const { errors, validate, isValid } = useLKSValidator({
    email: ['required', 'email'],
    age: ['required', 'min:1']
  });

  const onSubmit = (e: React.FormEvent) => {
    e.preventDefault();
    if (validate(formData)) {
      alert("Tahap Penyimpanan Berhasil Divalidasi!");
    }
  };

  return (
    <form onSubmit={onSubmit} className="grid gap-4">
      <input 
        placeholder="Alamat Email"
        onChange={(e) => setFormData({...formData, email: e.target.value})} 
      />
      {errors.email && <small className="text-red-500 italic">{errors.email}</small>}
      
      <button type="submit" disabled={!isValid}>Proses Input</button>
    </form>
  );
}

Mengakses Status Pengguna (Auth)

import { useLKSAuth } from '@jodijonatan/jo-client';

export function Header() {
  const { user, isLoggedIn, logout } = useLKSAuth();

  return (
    <header className="flex justify-between">
      <span>Modul B: Portal Admin</span>
      {isLoggedIn ? (
        <div className="flex gap-4">
           <span>Hai, {user?.username}</span>
           <button onClick={logout}>Keluar</button>
        </div>
      ) : (
        <span>Status: Guest</span>
      )}
    </header>
  );
}

🛠 Pemasangan ke Proyek

Direkomendasikan agar paket jo-client ini terpasang secara lokal berdampingan pada direktori kerja root Anda:

npm install -S file:../jo-client

(Catatan: Proyek yang di-build menggunakan jo-builder umumnya sudah menyematkan script di atas).