Every Day Carry (EDC)
A petite set of utilities which might've been in the JavaScript standard
library of an alternate universe.
Module is
For determining whether the value at a reference is of some type.
General
| name |
about |
every |
sees if every value meets every condition |
isType |
returns the name of a type as a string |
Collection
| name |
about |
isEmpty |
static methods to check if a collection is empty |
isArrayLike |
checks if array or typed array |
isObjectLike |
dictionary-like object |
isTypedVec |
|
isVector |
a vector is a non-empty list of arithmetic numbers |
notSparse |
sometimes JS arrays are "sparse" and react surprisingly to length and map |
Numeric
| name |
about |
isCounting |
1, 2, 3, ... |
isNatural |
0, 1, 2, ... |
isNegative |
checks if an arithmetic Number or BigInt is arithmetically negative |
isScalar |
checks if a Number is arithmetic, suitable for addition and multiplication |
Module constants
| name |
about |
| table |
console.table |
| log |
console.log |
| sin |
Math.sin |
| cos |
Math.cos |
| π |
Math.PI |
| QUOTES |
RegEx for single and double quotes |
| SPACE |
' ' |
| CHAR |
'' |
| ALPHABET |
abc...xyz |
Module math
| name |
about |
| θtoπ |
convert degrees to radians |
| πtoθ |
convert radians to degrees |
| gcd |
greatest common divisor of some numbers |
| lcm |
least common multiple of some numbers |
| distance |
finds the euclidian distance between two vectors |
| factorial |
finds the n-th factorial of a number as BigInt |
| combination |
from set of size n choose subsets of size k |
Module iteration
Utilities relating to array-like collections.
| name |
about |
| naturals |
generator for 0...n |
| slimObj |
strip prototype from an object |
| unfold |
process a value into a list while a condition |
| lazyUnfold |
generator for iterative unfold |
| transpose |
swaps the rows and columns of a 2-dimensional array |
| randoms |
|
Module asserts
| name |
about |
| 言 |
consumes a value and throws it -- specifically for the ternary operator |