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

@standardbeagle/data-router

v1.2.0

Published

A memory-only, XPath-based router for React that operates with data structures instead of URLs. Perfect for complex React components that need internal routing and data manipulation without interfering with the parent application's routing system.

Readme

@standardbeagle/data-router

A memory-only, XPath-based router for React that operates with data structures instead of URLs. Perfect for complex React components that need internal routing and data manipulation without interfering with the parent application's routing system.

Features

  • XPath Navigation: Navigate through data structures using XPath expressions
  • Data Manipulation: Built-in CRUD operations (merge, replace, append, delete)
  • Form Integration: Form components that automatically update data at specified XPaths
  • Memory-only: No browser URL integration - purely internal routing
  • TypeScript Support: Full TypeScript support with strict typing
  • React Hooks: Hook-based API for easy integration

Installation

npm install @standardbeagle/data-router

Basic Usage

import { DataProvider, useXPath, useData, Link, Form, Button } from '@standardbeagle/data-router';

// Initialize with some data
const initialData = {
  users: [
    { id: 1, name: 'John', profile: { email: '[email protected]' } }
  ],
  settings: { theme: 'light' }
};

function App() {
  return (
    <DataProvider initialData={initialData} initialXPath="/users[0]">
      <UserProfile />
    </DataProvider>
  );
}

function UserProfile() {
  const xpath = useXPath(); // "/users[0]"
  const targetData = useTargetData(); // { id: 1, name: 'John', profile: {...} }
  
  return (
    <div>
      <h1>Current Location: {xpath}</h1>
      <p>User: {targetData.name}</p>
      
      {/* Navigate to user's profile */}
      <Link to="profile">View Profile</Link>
      
      {/* Navigate to settings */}
      <Link to="/settings">Go to Settings</Link>
      
      {/* Form to update user data */}
      <Form targetXPath="/users[0]" operation="merge">
        <input name="name" defaultValue={targetData.name} />
        <Button dataAction="merge">Update User</Button>
      </Form>
    </div>
  );
}

Core Concepts

XPath Navigation

  • Absolute paths: /users[0]/profile/email
  • Relative paths: profile/settings (relative to current XPath)
  • Parent navigation: .. (go up one level), ../.. (go up two levels)

Data Operations

  • merge: Combine form data with existing object
  • replace: Replace entire object/value at XPath
  • append: Add to arrays or create new properties
  • delete: Remove properties/array elements

Components

DataProvider

Provides the data context and routing state.

<DataProvider 
  initialData={myData} 
  initialXPath="/users[0]"
>
  {children}
</DataProvider>

Link

Navigate to different XPaths (read-only navigation).

<Link to="/users[1]">Go to User 1</Link>
<Link to="../settings">Go to Settings</Link>

Form

Wrap form elements for data manipulation.

<Form targetXPath="/users[0]" operation="merge">
  <input name="email" />
  <Button dataAction="merge">Save</Button>
</Form>

Button

Submit button with data manipulation capabilities.

<Button 
  dataAction="replace" 
  targetXPath="/settings/theme"
  navigateTo="/settings"
>
  Update Theme
</Button>

Hooks

  • useXPath() - Get current XPath
  • useData() - Get entire data object
  • useTargetData() - Get data at current XPath
  • useNavigate() - Get navigation function
  • useDataManipulation() - Get data manipulation functions

License

ISC