Skip to content

utils 1.0.72

Install from the command line:
Learn more about npm packages
$ npm install @bhoos/utils@1.0.72
Install via package.json:
"@bhoos/utils": "1.0.72"

About this version

utils

Utility functions

fp

Utility functions with a functional programming flavour

  • partition : partition a list into two using a predicate
  • removeDuplicates
  • topologicalSort : find topological sort of a graph (represented a list of all nodes, and a function that returns children nodes of a given node)

string

String manipulation

  • prefixp : check a string for a given prefix. p stands for predicate (i.e. functions that return boolean)
  • removePrefix

checksum

Generate a numeric checksum value for the given input string

checksum(src: string): number

shuffle

A Fisher-Yates algorithm based array shuffler.

Performs an in-place shuffling and returns the same input array.

shuffle<T>(array: T[]): T[]

array: An array of any type

strToUint8

Convert utf-8 source string to an optimized uint8 (binary) array.

strToUint8(source: string)

trimNumber

Trim number to a max 4 digits with decimal place inbetween and suffixed by 'K', 'M', 'B', 'T' values.

trimNumber(number: number)

uint8ToStr

Convert uint8 (binary) array created by strToUint8 to the original source string

uint8ToStr(buffer: Uint8Array)

Details


Assets

  • utils-1.0.72.tgz

Download activity

  • Total downloads 550
  • Last 30 days 8
  • Last week 7
  • Today 0