Socket
Book a DemoInstallSign in
Socket

@ubloimmo/front-util

Package Overview
Dependencies
Maintainers
4
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ubloimmo/front-util

Utility types and functions for use in other libraries and satellites

latest
Source
npmnpm
Version
0.0.19
Version published
Maintainers
4
Created
Source

@ubloimmo/front-util

npm version

A collection of utility types and functions

Getting stated

Installation

Install the package with your manager of choice.

# npm
npm install @ubloimmo/front-util
# yarn
yarn add @ubloimmo/front-util
# bun
bun add @ubloimmo/front-util

Usage

Import an utility type...

import type { GenericFn, Nullish } from "@ubloimmo/front-util";

const addTwoNumbers: GenericFn<[number, number], number> = (a, b) => a + b;

const joinStrings: GenericFn<string[], string> = (...strings) => {
  return strings.join();
}

...or a function.

import type { Nullish } from "@ubloimmo/front-util";
import { isNumber } from "@ubloimmo/front-util";

const isMoreThanTen = (a: Nullish<number>) => {
  if (isNumber(a)) return a > 10;
  return false;
}

Exported values

Utility types

A bunch of generics for usage in various cases. All documented using jsdoc.

Function types

  • GenericFn
  • VoidFn
  • AsyncFn
  • MaybeAsyncFn
  • Predicate

Primitives

  • Primitives
  • NullishPritives

Union types

  • Nullable<T>
  • Optional<T>
  • Nullish<T>
  • NonNullable<T>
  • NonOptional<T>
  • NonNullish<T>

Object generics

  • KeyOf<TObject, TRestriction>
  • DeepKeyOf<TObject, TRestriction>
  • DeepRequired<T>
  • DeepNullish<T>
  • DeepNonNullish<T>
  • DeepNullable<T>
  • DeepNonNullable<T>
  • DeepOptional<T>
  • DeepNonOptional<T>
  • DeepPickLax<T, TKey>
  • DeepPick<TObject, TKey>

Utility functions

Some commonly used utility functions

Predicates

Functions that verify the type of a value at runtime. Type safe.

  • isNumber()
  • isString()
  • isBoolean()
  • isObject()
  • isArray()
  • isNull()
  • isUndefined()
  • isNullish()

Object functions

  • objectKeys()
  • objectValues()
  • objectEntries()
  • objectFromEntries()
  • transformObject()

Array functions

  • arrayFilter()

Logger

  • Logger() factory

Currently missing

Functions and type declarations that have yet to be added to this lib

Product-wide scalars

  • Address
  • Currency
  • UUID

Common transformers & normalizers

  • Currency parsers & transformers
    • Integer to double precision float parser
    • Double precision float to string formatter
  • Address parsers & formatter
  • Date parsers & formatters
  • String transformers
    • To Pascal case
    • To Kebab case
    • Common regular expressions
  • Object parsers, validators & transformers
    • Object value / key transformer
    • Object merge

FAQs

Package last updated on 25 Jun 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts