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

@syeedalireza/use-reverse-auction

v1.0.0

Published

Professional reverse auction package

Downloads

10

Readme

@syeedalireza/use-reverse-auction

A collection of headless React Hooks for managing complex reverse auction state on the client side.

Features

  • Headless UI: Provides logic and state management without dictating the UI, allowing you to use Tailwind, Material UI, or custom CSS.
  • Global State: Uses zustand under the hood for efficient, predictable state updates.
  • Bid Validation: Built-in logic to ensure bids are valid (e.g., lower than the current lowest bid).
  • Timer Management: Includes a dedicated hook for handling countdown timers.

Installation

npm install @syeedalireza/use-reverse-auction zustand date-fns

Usage

useReverseAuction

import { useReverseAuction } from '@syeedalireza/use-reverse-auction';

const AuctionComponent = ({ auctionId, endTime }) => {
  const { 
    state, 
    lowestBid, 
    bids, 
    timeRemaining, 
    placeBid, 
    isClosed 
  } = useReverseAuction({
    auctionId,
    initialEndTime: endTime,
    onBidPlaced: (bid) => console.log('New bid:', bid),
    onAuctionClosed: () => console.log('Auction ended!')
  });

  const handleBid = () => {
    placeBid({
      id: Math.random().toString(),
      bidderId: 'user-1',
      amount: (lowestBid?.amount || 100) - 10
    });
  };

  if (isClosed) return <div>Auction Closed! Winning bid: {lowestBid?.amount}</div>;

  return (
    <div>
      <h2>Time Remaining: {Math.floor(timeRemaining / 1000)}s</h2>
      <p>Current Lowest Bid: {lowestBid?.amount || 'None'}</p>
      <button onClick={handleBid}>Place Lower Bid</button>
      
      <ul>
        {bids.map(bid => (
          <li key={bid.id}>{bid.amount} by {bid.bidderId}</li>
        ))}
      </ul>
    </div>
  );
};

useBidTimer

import { useBidTimer } from '@syeedalireza/use-reverse-auction';

const TimerDisplay = ({ endTime }) => {
  const { hours, minutes, seconds, isExpired } = useBidTimer(endTime);

  if (isExpired) return <span>Time's up!</span>;

  return (
    <span>
      {hours}h {minutes}m {seconds}s
    </span>
  );
};

API

useReverseAuction(options)

Options:

  • auctionId (string): Unique identifier for the auction.
  • initialEndTime (number): Timestamp (ms) when the auction ends.
  • onBidPlaced (function): Optional callback when a bid is successfully placed.
  • onAuctionClosed (function): Optional callback when the timer hits zero.

Returns:

  • state ('DRAFT' | 'ACTIVE' | 'CLOSED'): Current auction state.
  • lowestBid (Bid | null): The current lowest bid.
  • bids (Bid[]): Array of all placed bids.
  • timeRemaining (number): Milliseconds remaining.
  • placeBid (function): Function to place a new bid. Throws if invalid.
  • isClosed (boolean): Convenience boolean for state === 'CLOSED'.

useBidTimer(endTime)

Arguments:

  • endTime (number | null): Timestamp (ms) when the timer should end.

Returns:

  • hours (number): Hours remaining.
  • minutes (number): Minutes remaining.
  • seconds (number): Seconds remaining.
  • isExpired (boolean): True if the current time is past the endTime.