👷 🔧 zero dependencies vanilla JavaScript utils.
This library is available through npm:
npm install @fabiocaccamo/utils.js
<script src=" https://cdn.jsdelivr.net/npm/@fabiocaccamo/utils.js/dist/utils.min.js"></script><script src="node_modules/@fabiocaccamo/utils.js/dist/utils.min.js"></script>var utils = require("@fabiocaccamo/utils.js");import utils from '@fabiocaccamo/utils.js';utils.array
-
all -
any -
clean -
clone -
contains -
equals -
flatten -
index -
insert -
max -
min -
paginate -
reduce -
remove -
replace -
rotate -
shuffle -
sort -
sum -
unique -
unzip -
zip
utils.base64
-
decode -
encode
utils.color
-
cmykToHex -
cmykToRgb -
hexToCmyk -
hexToRgb -
rgbToCmyk -
rgbToHex
utils.color.cmyk
-
toString -
toStringCSS
utils.color.hex
-
average -
distance -
gradient -
gradientMatrix -
interpolateBilinear -
interpolateLinear -
interpolateMultilinear -
nearest -
toCmyk -
toRgb -
toString -
toStringCSS
utils.color.rgb
-
average -
distance -
gradient -
gradientMatrix -
interpolateBilinear -
interpolateLinear -
interpolateMultilinear -
nearest -
toCmyk -
toRgb -
toString -
toStringCSS
utils.date
-
clone -
constrain -
format -
isFuture -
isPast -
max -
min -
parse -
timestamp -
today -
tomorrow -
yesterday -
yyyymmdd
utils.ease
-
backIn -
backInOut -
backOut -
bounceIn -
bounceInOut -
bounceOut -
circularIn -
circularInOut -
circularOut -
cubicIn -
cubicInOut -
cubicOut -
elasticIn -
elasticInOut -
elasticOut -
exponentialIn -
exponentialInOut -
exponentialOut -
none -
quadraticIn -
quadraticInOut -
quadraticOut -
quarticIn -
quarticInOut -
quarticOut -
quinticIn -
quinticInOut -
quinticOut -
sexticIn -
sexticInOut -
sexticOut -
sineIn -
sineInOut -
sineOut -
waveCosine -
waveSawtooth -
waveSine
utils.func
-
args -
attempt -
bind -
call -
debounce -
delay -
memoize -
noop -
repeat -
throttle -
until -
validate
utils.geom
utils.geom.point
-
add -
angle -
cross -
distance -
dot -
equals -
interpolate -
length -
magnitude -
project -
rect -
rotate -
scale -
subtract -
translate
utils.hex
-
decodeInt -
encodeInt
utils.json
-
decode -
encode
utils.math
-
average -
constrain -
cycle -
equals -
euclideanDistance -
factorial -
gcd -
lcm -
lerp -
map -
nearest -
normalize -
proportion -
roundDecimals -
roundToMultiple -
roundToNearest -
roundToPower -
sign -
summation
utils.math.interpolation
-
bilinear -
linear -
multilinear -
scalar
utils.number
-
isBetween -
isEven -
isFloat -
isNegative -
isOdd -
isPositive -
isPrime
utils.object
-
assign -
clean -
clone -
decodeBase64 -
decodeJSON -
decodeParameters -
encodeBase64 -
encodeJSON -
encodeParameters -
equals -
is -
keypath -
keys -
length -
map -
merge -
search -
values
utils.random
-
argument -
bit -
boolean -
color -
element -
float -
index -
integer -
map -
sign -
string
utils.string
-
contains -
endsWith -
icontains -
levenshteinDistance -
levenshteinSimilarity -
padLeft -
padRight -
padZeros -
render -
replace -
reverse -
rotate -
slugify -
startsWith -
toConstantCase -
toRandomCase -
toTitleCase -
toUpperCaseFirst -
trim -
trimLeft -
trimRight
utils.test
-
assertArray -
assertBase64 -
assertBoolean -
assertDate -
assertEqual -
assertError -
assertFalse -
assertFunction -
assertJSON -
assertNaN -
assertNone -
assertNotArray -
assertNotBase64 -
assertNotBoolean -
assertNotDate -
assertNotEqual -
assertNotError -
assertNotFunction -
assertNotJSON -
assertNotNone -
assertNotNull -
assertNotNumber -
assertNotObject -
assertNotRegExp -
assertNotString -
assertNotUndefined -
assertNull -
assertNumber -
assertNumberAlmostEqual -
assertObject -
assertRegExp -
assertString -
assertThrows -
assertTrue -
assertUndefined
utils.trigo
-
acosDeg -
angleDeg -
angleRad -
asinDeg -
atan2Deg -
atanDeg -
cosDeg -
cycleDeg -
degToRad -
fastDeg -
haversine -
hypo -
radToDeg -
sinDeg -
tanDeg
utils.type
-
isArray -
isBase64 -
isBoolean -
isDate -
isError -
isFunction -
isJSON -
isNaN -
isNone -
isNull -
isNumber -
isObject -
isRegExp -
isString -
isType -
isUndefined -
of
utils.url
-
getDomain -
getParameterByName -
getParameters -
getParametersDict -
getParametersList -
getParametersString -
getURL -
hasParameter -
isFile -
isHttp -
isHttps -
isLocalhost
utils.utf8
-
decode -
encode
utils.xml
removeNamespaces
git clone https://github.com/fabiocaccamo/utils.js.gitnpm install
npm run watch
npm run format(format code usingPrettiercode formatter, refer to .prettierrc for specific formatting options)
npm run build
Refer to SECURITY.md
Released under MIT License.