pma-utils
v1.0.10
Published
A collection of reusable utility functions for React and web development
Downloads
9
Maintainers
Readme
PMA Utils
A modern TypeScript utility library for React applications and web development.
Installation
pnpm add pma-utils
# or
npm install pma-utils
# or
yarn add pma-utilsUsage
React Hooks
useNuiEvent
Hook for handling NUI events in your React components.
import { useNuiEvent } from 'pma-utils';
function MyComponent() {
useNuiEvent('eventName', (data) => {
console.log('Event received:', data);
});
return <div>My Component</div>;
}useDebug
Debug hook for development environments.
import { useDebug } from 'pma-utils';
function MyComponent() {
const debug = useDebug();
debug.log('Component rendered');
return <div>My Component</div>;
}Utilities
fetchNui
Utility for making NUI calls.
import { fetchNui } from 'pma-utils';
const response = await fetchNui('getData', { id: 123 });randomNumber
Generate random integers within a specified range.
import { randomNumber } from 'pma-utils';
const dice = randomNumber(1, 6); // Returns 1-6
const percentage = randomNumber(0, 100); // Returns 0-100Development
# Install dependencies
pnpm install
# Start development mode
pnpm dev
# Run tests
pnpm test
# Run tests in watch mode
pnpm test:watch
# Type checking
pnpm typecheck
# Linting
pnpm lint
pnpm lint:fix
# Formatting
pnpm format
pnpm format:check
# Build for production
pnpm buildLicense
ISC
