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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@intelehealth/ayu-core

v0.0.1

Published

Intelehealth Ayu Core

Readme

@intelehealth/intelehealth-ayu-core

npm version License: MIT TypeScript React React Native

A universal React library for healthcare applications 🏥

Intelehealth's core library for React.js and React Native applications. A comprehensive universal library that provides essential utilities and services for healthcare applications, focusing on business logic without platform-specific dependencies.

✨ Why Choose This Library?

  • 🚀 Universal Compatibility - Works seamlessly with React.js and React Native
  • 🔒 TypeScript First - Full TypeScript implementation with strict type checking
  • 🏥 Healthcare Focused - Built specifically for healthcare applications
  • 📦 Tree-shakable - Import only what you need for optimal bundle size
  • 🧪 Well Tested - Comprehensive test coverage with Jest and React Testing Library
  • 🔧 Developer Friendly - Excellent developer experience with hot reloading and debugging
  • 📚 Well Documented - Complete API documentation and examples
  • 🛡️ Production Ready - Battle-tested in production healthcare applications

🚀 Features

  • Universal Compatibility: Works with React.js and React Native
  • TypeScript Support: Full TypeScript implementation with strict type checking
  • Business Logic Focus: No platform-specific dependencies
  • Testing Setup: Jest and React Testing Library configuration
  • Build System: Rollup for efficient bundling
  • Code Quality: ESLint, Prettier, and Husky for code standards
  • Git Hooks: Pre-commit and pre-push hooks for quality assurance
  • Documentation: Auto-generated API documentation
  • CI/CD Ready: GitHub Actions workflow included
  • NPM Publishing: Complete publishing setup
  • Code Ownership: GitHub CODEOWNERS for proper review process

🧩 Core Components

  • Storage: Simple, platform-agnostic storage utility for React and React Native
  • ApiService: HTTP client using Axios with retry logic and hooks
  • AuthService: Authentication state management
  • useLocalStorage: React hook for localStorage synchronization (React only)
  • useDebounce: React hooks for debouncing values and callbacks
  • Utility Functions: Date, string, and object manipulation utilities

📦 Installation

NPM

npm install @intelehealth/intelehealth-ayu-core

Yarn

yarn add @intelehealth/intelehealth-ayu-core

PNPM

pnpm add @intelehealth/intelehealth-ayu-core

Requirements

  • Node.js >= 20.0.0
  • React >= 18.0.0
  • TypeScript >= 5.0.0 (recommended)

What's Included in NPM Package

The published NPM package contains only the essential files:

  • dist/ - Compiled JavaScript and TypeScript definitions
  • README.md - This documentation
  • LICENSE - MIT License file

Development files (source code, tests, configs, .vscode, etc.) are excluded to keep the package lightweight.

Package Size

  • Minified + Gzipped: ~15KB
  • Tree-shakable: Import only what you need
  • Zero dependencies: Only peer dependencies (React)

🚀 Quick Start

Get started in minutes with our comprehensive examples:

React (Web) Usage

import {
  Storage,
  ApiService,
  AuthService,
  useLocalStorage,
  useDebounce,
} from '@intelehealth/intelehealth-ayu-core';

// useLocalStorage works in React web apps
const [value, setValue] = useLocalStorage('key', 'default');

React Native Usage

import {
  Storage,
  ApiService,
  AuthService,
  useDebounce,
} from '@intelehealth/intelehealth-ayu-core';

// useLocalStorage is not available in React Native
// Use the Storage class instead for persistent storage
const storage = new Storage('app_');
await storage.set('key', 'value');
const value = await storage.get('key');

Full Import

import {
  Storage,
  ApiService,
  AuthService,
} from '@intelehealth/intelehealth-ayu-core';

// Use the Storage utility
const storage = new Storage('app_');
await storage.set('user', { id: 1, name: 'John' });

// Use the API service
const api = new ApiService({ baseURL: 'https://api.example.com' });
const response = await api.get('/users');

// Use the Auth service
const auth = new AuthService();
await auth.login({ email: '[email protected]', password: 'password' });

Folder-wise Imports (Tree-shaking friendly)

// Import only what you need from specific folders
import { Storage, appStorage } from '@intelehealth/intelehealth-ayu-core/core';
import { ApiService } from '@intelehealth/intelehealth-ayu-core/services';
import {
  useLocalStorage,
  useDebounce,
} from '@intelehealth/intelehealth-ayu-core/hooks';
import {
  formatDate,
  deepClone,
} from '@intelehealth/intelehealth-ayu-core/utils';
import type {
  ApiResponse,
  User,
} from '@intelehealth/intelehealth-ayu-core/types';

📚 API Documentation

Storage Class

A platform-agnostic storage utility that works with both React and React Native.

import { Storage } from '@intelehealth/intelehealth-ayu-core';

const storage = new Storage('app_');

// Set a value
await storage.set('user', { id: 1, name: 'John' });

// Get a value
const user = await storage.get('user');

// Remove a value
await storage.remove('user');

// Clear all values
await storage.clear();

ApiService Class

HTTP client with retry logic and error handling.

import { ApiService } from '@intelehealth/intelehealth-ayu-core';

const api = new ApiService({
  baseURL: 'https://api.example.com',
  timeout: 5000,
  retries: 3,
});

// GET request
const users = await api.get('/users');

// POST request
const newUser = await api.post('/users', {
  name: 'John',
  email: '[email protected]',
});

// PUT request
const updatedUser = await api.put('/users/1', { name: 'John Updated' });

// DELETE request
await api.delete('/users/1');

AuthService Class

Authentication state management.

import { AuthService } from '@intelehealth/intelehealth-ayu-core';

const auth = new AuthService();

// Login
await auth.login({ email: '[email protected]', password: 'password' });

// Check if user is authenticated
const isAuthenticated = auth.isAuthenticated();

// Get current user
const user = auth.getCurrentUser();

// Logout
await auth.logout();

React Hooks

useLocalStorage (React only)

import { useLocalStorage } from '@intelehealth/intelehealth-ayu-core';

function MyComponent() {
  const [value, setValue] = useLocalStorage('key', 'defaultValue');

  return (
    <div>
      <p>Value: {value}</p>
      <button onClick={() => setValue('new value')}>
        Update Value
      </button>
    </div>
  );
}

useDebounce

import { useDebounce } from '@intelehealth/intelehealth-ayu-core';

function SearchComponent() {
  const [searchTerm, setSearchTerm] = useState('');
  const debouncedSearchTerm = useDebounce(searchTerm, 500);

  useEffect(() => {
    if (debouncedSearchTerm) {
      // Perform search
      performSearch(debouncedSearchTerm);
    }
  }, [debouncedSearchTerm]);

  return (
    <input
      value={searchTerm}
      onChange={(e) => setSearchTerm(e.target.value)}
      placeholder="Search..."
    />
  );
}

Utility Functions

import {
  formatDate,
  deepClone,
  capitalize,
  generateId,
} from '@intelehealth/intelehealth-ayu-core/utils';

// Date utilities
const formattedDate = formatDate(new Date(), 'YYYY-MM-DD');

// Object utilities
const cloned = deepClone(originalObject);

// String utilities
const capitalized = capitalize('hello world'); // "Hello world"

// Generate unique ID
const id = generateId(); // "abc123def456"

🔧 Configuration

TypeScript Configuration

Add to your tsconfig.json:

{
  "compilerOptions": {
    "moduleResolution": "node",
    "allowSyntheticDefaultImports": true,
    "esModuleInterop": true
  }
}

React Native Configuration

For React Native projects, ensure you have the required peer dependencies:

npm install react react-native

🐛 Troubleshooting

Common Issues

1. TypeScript errors with imports

  • Ensure you have TypeScript 5.0+ installed
  • Check your tsconfig.json configuration

2. React Native compatibility

  • Make sure you're using React Native 0.70+
  • Some hooks like useLocalStorage are not available in React Native

3. Build errors

  • Clear your node_modules and reinstall
  • Check your bundler configuration

Getting Help

📄 License

MIT License - see LICENSE file for details.

🔗 Links