# Module @welshman/lib

# @welshman/lib

Some general-purpose utilities for use in @welshman apps.

Includes:

- LRU cache implementation
- Worker for throttling work to avoid locking up the UI
- URL normalization (taken from normalize-url)
- A global `ctx` variable which can be used for global configuration
- CustomPromise, which provides an error type, and `defer` utility
- Ramda-like utilities, but without auto-currying
- Utils for throttling, working with nil, json, fetch, deep equals, etc.

##
Classes

Emitter
Fluent
LRUCache
Worker

##
Type Aliases

CustomPromise
Deferred
Maybe
Nil
OmitAllStatics
OmitStatics
WorkerOpts

##
Variables

ctx
DAY
HOUR
MINUTE
MONTH
QUARTER
WEEK
YEAR

##
Functions

add
addToKey
addToMapKey
ago
always
append
assoc
avg
batch
batcher
bech32ToHex
between
cached
choice
chunk
chunks
clamp
concat
dec
defer
difference
displayDomain
displayUrl
div
drop
ellipsize
ensureNumber
ensurePlural
eq
equals
fetchJson
ffirst
first
flatten
fromPairs
getJson
groupBy
gt
gte
hash
hexToBech32
identity
ifLet
inc
indexBy
initArray
insert
int
intersection
isIterable
isNil
isPojo
last
lt
lte
makePromise
mapKeys
mapVals
max
memoize
mergeLeft
mergeRight
min
ms
mul
ne
noop
normalizeUrl
not
now
nth
nthEq
nthNe
num
omit
omitVals
once
parseJson
partition
pick
postJson
prop
pushToKey
pushToMapKey
randomId
randomInt
range
remove
sample
setContext
setJson
shuffle
simpleCache
sleep
sort
sortBy
splitAt
stripProtocol
sub
sum
switcher
take
throttle
throttleWithValue
toggle
toIterable
tryCatch
union
uniq
uniqBy
uploadFile
without