Module @welshman/lib

@welshman/lib version

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
LRUCache
Worker

Type Aliases

CustomPromise
Deferred
Maybe
Nil
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
complement
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
pluck
postJson
prop
pushToKey
pushToMapKey
randomId
randomInt
range
remove
sample
setContext
setJson
shuffle
simpleCache
sleep
sort
sortBy
spec
splitAt
stripProtocol
sub
sum
switcher
take
throttle
throttleWithValue
toggle
toIterable
tryCatch
union
uniq
uniqBy
uploadFile
within
without