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

fuji-moto

v1.0.0

Published

A lightweight utility toolkit for everyday developer problems

Downloads

15

Readme

fuji-moto

A lightweight utility toolkit for everyday developer problems. Built with TypeScript, zero-config, and no heavy dependencies.

Installation

npm install fuji-moto

Usage

import {
  // Safe Utilities
  safeGet,
  isDefined,
  // Async Utilities
  tryOrDefault,
  retry,
  // Formatting Utilities
  formatNGN,
  normalizePhone,
  // Utility Helpers
  chunk,
  debounce,
  throttle,
} from "fuji-moto";

API Reference

Safe Utilities

safeGet(obj, path, defaultValue)

Safely gets a nested property from an object using a dot-notation path.

const user = { profile: { name: "John", age: 30 } };

safeGet(user, "profile.name", "Unknown"); // "John"
safeGet(user, "profile.email", "N/A"); // "N/A"
safeGet(user, "invalid.path", null); // null

isDefined(value)

Checks if a value is defined (not null and not undefined).

isDefined(42); // true
isDefined("hello"); // true
isDefined(null); // false
isDefined(undefined); // false

Async Utilities

tryOrDefault(asyncFn, fallback)

Executes an async function and returns its result, or a fallback value if it throws.

const result = await tryOrDefault(
  async () => {
    const data = await fetch("/api/data");
    return data.json();
  },
  { error: true }
);
// Returns the fetched data or { error: true } if fetch fails

retry(asyncFn, options)

Retries an async function a specified number of times with a delay between attempts.

const result = await retry(
  async () => {
    return await fetchData();
  },
  { retries: 5, delay: 2000 } // Retry 5 times with 2 second delay
);

Options:

  • retries (default: 3) - Number of retry attempts
  • delay (default: 1000) - Delay in milliseconds between retries

Formatting Utilities

formatNGN(amount)

Formats a number as Nigerian Naira currency.

formatNGN(1234.56); // "₦1,234.56"
formatNGN(1000000); // "₦1,000,000.00"
formatNGN("500.5"); // "₦500.50"

normalizePhone(phone)

Normalizes a Nigerian phone number to the +234 format.

normalizePhone("08012345678"); // "+2348012345678"
normalizePhone("2348012345678"); // "+2348012345678"
normalizePhone("+2348012345678"); // "+2348012345678"
normalizePhone("8012345678"); // "+2348012345678"
normalizePhone("080 1234 5678"); // "+2348012345678" (handles spaces)

Utility Helpers

chunk(array, size)

Splits an array into chunks of a specified size.

chunk([1, 2, 3, 4, 5], 2); // [[1, 2], [3, 4], [5]]
chunk([1, 2, 3, 4], 2); // [[1, 2], [3, 4]]
chunk([1, 2, 3], 1); // [[1], [2], [3]]

debounce(fn, delay)

Creates a debounced function that delays invoking the function until after the specified delay has passed since the last invocation.

const debouncedSearch = debounce((query: string) => {
  console.log("Searching:", query);
}, 300);

// Multiple rapid calls will only execute once after 300ms of inactivity
debouncedSearch("hello");
debouncedSearch("world"); // Only this will execute after 300ms

throttle(fn, delay)

Creates a throttled function that invokes the function at most once per specified delay period.

const throttledScroll = throttle(() => {
  console.log("Scrolled");
}, 100);

// Multiple rapid calls will execute at most once per 100ms
throttledScroll();
throttledScroll();
throttledScroll();

Development

# Build the project
npm run build

# Run tests
npm test

License

MIT


Publishing Guide

Step 1: Check Package Name Availability

Before publishing, verify that the package name fuji-moto is available on npm:

npm view fuji-moto

If the package doesn't exist, you'll see a 404 error, which means the name is available. If it exists, you'll need to choose a different name and update it in package.json.

Step 2: Log in to npm

If you don't have an npm account, create one at npmjs.com.

Then log in via the command line:

npm login

You'll be prompted for:

  • Username
  • Password
  • Email address
  • One-time password (if you have 2FA enabled)

Verify you're logged in:

npm whoami

Step 3: Publish the Package

Make sure you've built the project:

npm run build

Then publish the package publicly:

npm publish --access public

Note: If this is your first time publishing a scoped package (packages starting with @), you'll need to use --access public. Since fuji-moto is unscoped, you can simply use:

npm publish

The prepublishOnly script in package.json will automatically run npm run build before publishing, ensuring the latest code is compiled.

Step 4: Verify Installation

After publishing, verify the package can be installed:

# In a different directory or project
npm install fuji-moto

Then test the import:

import { safeGet, formatNGN } from "fuji-moto";

console.log(formatNGN(1000)); // Should output: ₦1,000.00

Updating the Package

When you make changes and want to publish a new version:

  1. Update the version in package.json (or use npm version patch|minor|major)
  2. Run npm publish again
# Automatically bump version and publish
npm version patch  # 1.0.0 -> 1.0.1
npm publish

Important Notes

  • The files field in package.json ensures only the dist directory is published
  • The prepublishOnly script ensures the package is built before publishing
  • Make sure all tests pass before publishing
  • Consider adding a .npmignore file if you need to exclude additional files