@onbeam/utils
v1.4.0
Published
A collection of useful utility functions and hooks which can be used fully standalone or along with the rest of the @onbeam packages. View all utils, hooks and variables [here](https://beam-packages.vercel.app/?path=/docs/utils-functions-absbigint--docs).
Downloads
2,917
Maintainers
Keywords
Readme
@onbeam/utils
A collection of useful utility functions and hooks which can be used fully standalone or along with the rest of the @onbeam packages. View all utils, hooks and variables here.
Table of Contents
Installation
Install the package using your preferred package manager:
npm install @onbeam/utils
# or
yarn add @onbeam/utils
# or
pnpm add @onbeam/utils
To keep all @onbeam
packages updated, you can use the CLI:
npx @onbeam/cli update -d [directory]
Tree-Shaking Support
This package is fully tree-shakable, ensuring that only the utils, hooks and variables you import are included in your final bundle, optimizing your app's performance.
Examples
Example 1: Utility function usage
import { formatNumber } from "@onbeam/utils";
formatNumber(1234567); // "1.23M"
formatNumber(1234567, { maximumFractionDigits: 1 }); // "1.2M"
Example 2: Hook usage
import { useClipboard } from "@onbeam/utils";
const App = () => {
const { onCopy, hasCopied } = useClipboard("Hello, World!");
return <button onClick={onCopy}>{hasCopied ? "Copied!" : "Copy"}</button>;
};
For more examples, check out the docs of all individual utils, hooks and variables here.
All @onbeam
packages
- @onbeam/automation-api-client
- @onbeam/biome-config
- @onbeam/cli
- @onbeam/errors
- @onbeam/features
- @onbeam/icons
- @onbeam/player-api-client
- @onbeam/sdk
- @onbeam/styled-system
- @onbeam/ui
- @onbeam/utils
That's it! Happy coding! 🌈