@appello/common
@appello/common
A collection of reusable TypeScript utilities, React hooks, helper types, and shared functions for building modern React and React Native applications.
Designed to be lightweight, tree-shakable, and framework-agnostic wherever possible.
Table of Contents
Features
- Reusable React hooks
- Utility functions for everyday development
- Shared TypeScript types
- Fully typed API
- Tree-shakable exports
- Compatible with React and React Native
- Immutable helper functions
- Zero runtime dependencies (except where required)
Installation
npm install @appello/common
Quick Start
Import only what you need.
import { useInterval, useDebounce, isNil, deepMergeObjects } from '@appello/common';
Every utility is exported from the package root.
import { entries, keys, pick } from '@appello/common';
Hooks
The package includes reusable React hooks for state management, lifecycle helpers, timers, forms, and utility behavior.
| Category | Hooks |
|---|---|
| Timing | useInterval, useCodeTimer, useDebounce |
| Lifecycle | useMountEffect, useUnmountEffect, useUpdateEffect, useFirstMountState, useIsMounted |
| State | useDefault, useStateObject, useStep, useSwitchValue, usePrevious, useLatest, useManualUpdate, useListState |
| Forms | useHookFormPersist, useSelectOptions |
| Utilities | useCombinedRef, useMemoCallback, useQueryParamsBuilder, useIsClient |
Each hook has its own documentation inside the corresponding package folder.
Utilities
Utilities are grouped by purpose.
Type Guards
isArrayisBlobisDateisEmptyisFileisFloatisFunctionisIntisNilisNumberisObjectisPrimitiveisPromiseisStringisSymbol
Object Utilities
deepMergeObjectsdeepEqualentrieskeysomitpickdeepKeysshake
Array Utilities
differenceintersectionuniqcompactmergeCollectionByKeygroupforkalphabeticalchunksequencereplaceOrAppendfilterMapkeyBycountBy
Browser & Environment
checkIsServercheckNavigator
File Utilities
formDataBuildermakeFormDatamapFormDatatoBase64getFileExtensiongetFileName
String Utilities
capitalizetruncatepluralizeenumKeyToReadable
Number Utilities
formatCurrencyformatNumbertoFinite
URL Utilities
makeQueryString
Miscellaneous
debouncethrottlesleepnoopgetDirtyValuesgetProtogetWeekdaysNamesenumToSelectOptions
Types
The package exports commonly used utility types such as:
ElementTypeNullableNotNullableNillableNotNillableUnidentifiableNegativeValueOfAnyObjectAnyPromisePartialRecordPartialDeepResponseErrorsUnknownFunctionAnyFunctionPromiseTypeRequiredKeysOptionalKeysMergeAsyncReturnTypeFirstArgument
Development
Every public module should be exported from the package root.
import { useInterval, deepMergeObjects, isNil } from '@appello/common';
When adding a new hook or utility:
- create a dedicated folder;
- export it through an
index.ts; - re-export it from the package root;
- include a README with usage examples.
This keeps the API consistent and enables tree-shaking.
For more examples and advanced usage, check the test files in the repository.