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

dev-utils-all-in-one

v1.0.2

Published

All-in-one developer utility package with intelligent search, API response normalization, and automatic CRUD generation

Downloads

100

Readme

All-in-One Developer Utility Package

A comprehensive, production-ready TypeScript utility package providing intelligent search, API response normalization, and automatic CRUD generation. Built with zero dependencies (except dev dependencies) and optimized for performance.

Features

🔍 Smart Search Engine

  • Fuzzy search - Find matches even with typos
  • Typo-tolerant search - Handles spelling mistakes intelligently
  • Weighted field-based search - Prioritize certain fields
  • Multi-language search - Support for multiple languages
  • Context-aware search - Search across primary and context fields
  • Case insensitive search - Works regardless of case
  • Partial matching - Finds partial word matches
  • Phonetic matching - Matches similar-sounding words
  • Synonym matching - Expand queries with synonyms
  • Highlighted results - Get highlighted match text

🔄 Universal Data Adapter

  • Automatic format detection - Works with any API response format
  • REST API support - Standard REST responses
  • GraphQL support - GraphQL response structures
  • Custom backend formats - Handles custom API structures
  • Pagination detection - Automatically finds pagination info
  • Nested structure support - Works with deeply nested data

⚡ Auto CRUD Generator

  • Automatic CRUD operations - Generate full CRUD service layer
  • Pagination support - Built-in pagination handling
  • Error handling - Comprehensive error management
  • Response normalization - Uses universal data adapter
  • Caching layer - Optional in-memory caching
  • Retry mechanism - Automatic retry on failures
  • Timeout handling - Request timeout support
  • Query builder - Easy filtering and sorting
  • Request cancellation - AbortController support

Installation

npm install dev-utils-all-in-one

Quick Start

Smart Search Engine

import { smartSearchEngine } from 'dev-utils-all-in-one';

const users = [
  { id: 1, name: 'John Doe', email: '[email protected]' },
  { id: 2, name: 'Jane Smith', email: '[email protected]' },
];

const results = smartSearchEngine(users, 'john', {
  fields: ['name', 'email'],
  highlightMatches: true,
  typoTolerance: true,
});

results.forEach(result => {
  console.log(`Score: ${result.score}`);
  console.log(`Name: ${result.item.name}`);
  console.log(`Matches: ${result.matches.join(', ')}`);
});

Universal Data Adapter

import { adaptResponse } from 'dev-utils-all-in-one';

// Works with any API response format
const apiResponse = {
  data: [{ id: 1, name: 'Item 1' }],
  total: 100,
  page: 1,
  limit: 10,
};

const normalized = adaptResponse(apiResponse);
// Returns: { data: [...], pagination: {...}, success: true }

Auto CRUD Generator

import { autoCrudGenerator } from 'dev-utils-all-in-one';

const userService = autoCrudGenerator({
  baseUrl: 'https://api.example.com/users',
  caching: true,
  pagination: true,
});

// Get all users
const response = await userService.getAll({
  page: 1,
  limit: 10,
  filter: { role: 'admin' },
});

// Get by ID
const user = await userService.getById(1);

// Create
const newUser = await userService.create({
  name: 'John Doe',
  email: '[email protected]',
});

// Update
const updated = await userService.update(1, {
  name: 'John Updated',
});

// Delete
await userService.delete(1);

API Reference

Smart Search Engine

smartSearchEngine<T>(data, query, options)

Parameters:

  • data: T[] - Array of items to search
  • query: string - Search query
  • options: SmartSearchOptions - Search configuration

Options:

  • fields: string[] - Fields to search (required)
  • weights?: Record<string, number> - Field weights (default: 1.0)
  • language?: string - Language code (default: 'en')
  • typoTolerance?: boolean - Enable typo tolerance (default: true)
  • fuzzyLevel?: number - Max Levenshtein distance (default: 2)
  • enableSynonyms?: boolean - Enable synonym matching (default: false)
  • contextFields?: string[] - Context fields (lower weight)
  • highlightMatches?: boolean - Include highlighted text (default: false)

Returns: SmartSearchResult<T>[] - Sorted by score (descending)

Result Structure:

interface SmartSearchResult<T> {
  item: T;
  score: number;
  matches: string[];
  highlightedText?: string;
}

Universal Data Adapter

adaptResponse(response)

Parameters:

  • response: any - API response in any format

Returns: StandardResponse<T>

Response Structure:

interface StandardResponse<T> {
  data: T[];
  pagination?: {
    total: number;
    page: number;
    limit: number;
    totalPages: number;
  };
  message?: string;
  success: boolean;
  errors?: any;
}

Auto CRUD Generator

autoCrudGenerator<T>(options)

Parameters:

  • options: CrudGeneratorOptions - Configuration

Options:

  • baseUrl: string - API base URL (required)
  • caching?: boolean - Enable caching (default: false)
  • pagination?: boolean - Enable pagination (default: true)
  • httpClient?: HttpClient - Custom HTTP client
  • timeout?: number - Request timeout in ms (default: 30000)
  • retries?: number - Retry count (default: 3)
  • retryDelay?: number - Retry delay in ms (default: 1000)

Returns: CrudService<T>

Service Methods:

  • getAll(options?) - Get all items with pagination/filtering
  • getById(id, config?) - Get item by ID
  • create(data, config?) - Create new item
  • update(id, data, config?) - Update item
  • delete(id, config?) - Delete item

Advanced Usage

Custom HTTP Client

import axios from 'axios';

const customClient = {
  get: (url, config) => axios.get(url, config).then(r => r.data),
  post: (url, data, config) => axios.post(url, data, config).then(r => r.data),
  put: (url, data, config) => axios.put(url, data, config).then(r => r.data),
  patch: (url, data, config) => axios.patch(url, data, config).then(r => r.data),
  delete: (url, config) => axios.delete(url, config).then(r => r.data),
};

const service = autoCrudGenerator({
  baseUrl: 'https://api.example.com',
  httpClient: customClient,
});

Request Cancellation

const controller = new AbortController();

// Cancel after 1 second
setTimeout(() => controller.abort(), 1000);

const response = await service.getAll({
  signal: controller.signal,
});

Weighted Search

const results = smartSearchEngine(data, 'query', {
  fields: ['name', 'description', 'tags'],
  weights: {
    name: 2.0,        // Name matches are 2x more important
    description: 1.5, // Description matches are 1.5x
    tags: 0.5,        // Tags are less important
  },
});

Tree Shaking

The package supports tree-shaking. Import only what you need:

// Import specific modules
import { smartSearchEngine } from 'dev-utils-all-in-one/smartSearchEngine';
import { adaptResponse } from 'dev-utils-all-in-one/universalDataAdapter';
import { autoCrudGenerator } from 'dev-utils-all-in-one/autoCrudGenerator';

Performance

  • Optimized for large datasets - Handles 10k+ records efficiently
  • Zero dependencies - Minimal bundle size
  • Fast algorithms - Optimized Levenshtein distance and search algorithms
  • Memory efficient - Smart caching with TTL

Browser Support

  • Modern browsers with ES2020 support
  • Node.js 14+

TypeScript

Full TypeScript support with comprehensive type definitions.

Testing

npm test
npm run test:coverage

Building

npm run build

License

MIT

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Examples

See the examples/ directory for more usage examples:

  • smartSearchExample.ts - Search engine examples
  • dataAdapterExample.ts - Data adapter examples
  • crudGeneratorExample.ts - CRUD generator examples