You're Invited:Meet the Socket Team at RSAC and BSidesSF 2026, March 23–26.RSVP
Socket
Book a DemoSign in
Socket

@blofin/helper

Package Overview
Dependencies
Maintainers
3
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@blofin/helper

A TypeScript utility library with modular architecture

latest
npmnpm
Version
0.3.0
Version published
Maintainers
3
Created
Source

@blofin/helper

A TypeScript utility library with modular architecture.

Features

  • 📦 Modular Architecture: Organized by domain modules
  • 🎯 Tree-shaking Support: Import only what you need
  • 📚 TypeScript: Full type safety
  • 🧪 Jest Testing: Comprehensive test coverage
  • 📖 Storybook: Interactive documentation

Installation

pnpm add @blofin/helper
# or
npm install @blofin/helper
# or
yarn add @blofin/helper

Modules

calc

Calculation module using bignumber.js

import { add, subtract, multiply, divide, num } from '@blofin/helper/calc';

add(1, 2); // '3'
add(1, 2, 3, 4); // '10'
subtract(5, 3); // '2'
multiply(2, 3, 4); // '24'
divide(10, 2); // '5'
num('123.456'); // BigNumber instance

format

Formatting utilities

import { 
  formatNumber, 
  displayNumber, 
  displayCurrency, 
  displayPercent,
  compositeDisplayNumber,
  withCurrency,
  withThousand
} from '@blofin/helper/format';

// Core number formatting (returns number)
formatNumber(123.456, 2); // 123.46

// Display formatting (returns string)
displayNumber(1234.56, { currency: { symbol: '$' }, thousands: { enabled: true } }); 
// '$1,234.56'

// Quick entry functions
displayCurrency(1234.56, '$'); // '$1,234.56'
displayPercent(0.1234); // '12.34%'

// Composite display with function composition
compositeDisplayNumber(1123.133, displayCurrency, withThousand()); 
// '$1,123.13'

storage

LocalStorage and SessionStorage utilities

import { 
  getLocalStorage, 
  setLocalStorage, 
  removeLocalStorage,
  getSessionStorage,
  setSessionStorage
} from '@blofin/helper/storage';

setLocalStorage('key', 'value');
const value = getLocalStorage('key'); // 'value'
removeLocalStorage('key');

setSessionStorage('sessionKey', 'sessionValue');
const sessionValue = getSessionStorage('sessionKey');

utils

General utility functions

import { isEmpty, deepClone } from '@blofin/helper/utils';

isEmpty(null); // true
isEmpty(''); // true
isEmpty([]); // true
isEmpty({}); // true
deepClone({ a: 1, b: { c: 2 } }); // { a: 1, b: { c: 2 } }

fp

Functional programming utilities

import { compose, pipe, curry, memoize, awaitEither } from '@blofin/helper/fp';

// Compose functions (right to left)
const add = (x: number) => x + 1;
const multiply = (x: number) => x * 2;
const composed = compose(multiply, add);
composed(5); // 12 (5+1 then *2)

// Pipe functions (left to right)
const piped = pipe(add, multiply);
piped(5); // 12 (5+1 then *2)

// Curry
const addCurried = curry((a: number, b: number) => a + b);
addCurried(1)(2); // 3

// Memoize
const expensiveFn = memoize((n: number) => n * n);
expensiveFn(5); // 25 (computed)
expensiveFn(5); // 25 (cached)

ui

UI components (React)

import { Countdown } from '@blofin/helper/ui';

<Countdown target={Date.now() + 60000} />

Usage

Full Import

import * as helper from '@blofin/helper';

helper.calc.add(1, 2); // '3'
helper.format.displayNumber(1234.56, { currency: { symbol: '$' } }); // '$1,234.56'
helper.utils.isEmpty(null); // true
helper.storage.setLocalStorage('key', 'value');
import { add, multiply } from '@blofin/helper/calc';
import { displayNumber, displayCurrency } from '@blofin/helper/format';
import { isEmpty, deepClone } from '@blofin/helper/utils';
import { compose, pipe } from '@blofin/helper/fp';

This approach enables tree-shaking, so only the imported modules will be bundled.

Development

Setup

pnpm install

Build

pnpm run build

Test

pnpm test
pnpm run test:watch
pnpm run test:coverage

Storybook

pnpm run storybook

Visit http://localhost:6006 to view the documentation.

Build Storybook

pnpm run build-storybook

Project Structure

blofin-helper/
├── src/
│   ├── calc/          # Calculation module
│   ├── format/      # Formatting module
│   ├── storage/       # Storage module
│   ├── utils/         # Utility functions
│   ├── fp/            # Functional programming
│   ├── ui/            # UI components
│   └── index.ts       # Main entry point
├── tests/             # Test files
├── stories/           # Storybook stories
├── dist/              # Build output
└── .storybook/        # Storybook configuration

License

MIT

Keywords

typescript

FAQs

Package last updated on 06 Feb 2026

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