@onbeam/utils
TypeScript icon, indicating that this package has built-in type declarations

1.13.0 • Public • Published

@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


That's it! Happy coding! 🌈

Readme

Keywords

none

Package Sidebar

Install

npm i @onbeam/utils

Weekly Downloads

215

Version

1.13.0

License

MIT

Unpacked Size

253 kB

Total Files

8

Last publish

Collaborators

  • mlewinski
  • lvandernoll
  • robinvandiesenmeritcircle
  • victor-boucher
  • royscheepensdept
  • robbyuitbeijerse