@piplup/utilsHelpers
Helpers Overview
Small utility functions exported by @piplup/utils.
compact
Removes falsy values (null, undefined, false, 0, "" and NaN) from an array. A non-array argument returns [].
import { compact } from "@piplup/utils";
compact([1, null, 2, undefined]); // [1, 2]
compact([0, 1, "", "a", false]); // [1, "a"]execSequentially
Run multiple functions in sequence producing a new function.
import { execSequentially } from "@piplup/utils";
const combined = execSequentially(fn1, fn2);
combined();forkRef
Utilities for combining multiple refs.
import { forkRef } from "@piplup/utils";
const ref = forkRef(refA, refB);hasOwnProperty
Type-safe hasOwnProperty helper.
import { hasOwnProperty } from "@piplup/utils";
if (hasOwnProperty(obj, 'key')) { /* ... */ }setRef
Helper to set callback or mutable refs.
Storage helpers: getItem, setItem, removeItem
Small wrappers around localStorage access; use useLocalStorage hook for reactive state.