1
0
Fork 0
js-utils/README.md

5.2 KiB

JS Utils

This project is a collection of utilities meant to extend lodash, collected from my other Typescript projects, lightly documented, and heavily tested.

Contents

Status

Pipeline status Lines of Code Test coverage MIT license FOSSA Status

Open bug count Open issue count Closed issue count

Renovate badge Dependency status Dev dependency status Known vulnerabilities

Maintainability score Technical debt ratio Quality issues Language grade: JavaScript Total alerts

Releases

github release link github release version github commits since release

npm package link npm release version Typescript definitions

Usage

Install:

yarn add -D @apextoaster/js-utils

And import:

import { mustExist } from '@apextoaster/js-utils';

The library is bundled and has no dependencies.

Features

Features utilities and helpers for:

  • Array
    • assertions/guards:
      • hasItems
      • isArray for both Array/ReadonlyArray
      • isEmpty
      • lengthOf
    • conversion
      • filterZip
      • toArray
  • Array Mapper
    • array-to-map converter, reduces an array of values to a map, using an array of keys
  • Async
    • timed promises
      • defer/deferValue
      • deferUntil
      • timeout
  • Buffer
    • concatenation
      • concat
      • encode
  • Checklist
    • allow/deny list
  • Child Process
    • childResult
    • writeInput
  • Env Vars
    • isDebug
  • Logger
    • test logging helpers
  • Map
    • types
      • MapLike
    • assertions/guards:
      • mustGet
    • null-safe helpers
      • getOrDefault
    • helpers for Map<K, Array<V>>
      • getHead/getHeadOrDefault
      • setOrPush
    • concat/merge
      • mergeMap
      • pushMergeMap
    • conversion
      • entriesOf
      • makeDict
      • makeMap
      • pairsToMap
  • Math
    • predicates for functional methods
      • sum
  • Maybe
    • types
      • Maybe
      • None
    • assertions/guards
      • doesExist
      • mustExist
      • mustDefault
      • mustFind
      • removeNone
    • null-safe helpers
      • isNone
      • isSome
  • Predicate
    • types for functional methods
  • Reflect
    • getConstructor
    • getMethods
  • Signal
    • wait for OS signal
      • signal
  • String
    • leftPad
    • trim with suffix