@aseemtaneja/utils
v0.0.17
Published
A bunch of utilities that I use in my projects.
Downloads
13
Readme
A bunch of utilities that I use in my projects.
Installation
npm install @aseemtaneja/utils@latest
Utilities
Strings
joinTruthy
- Joins an array of strings, ignoring falsy values.
Arrays
sampleOne
- Plucks a random item from an array.
Objects
shallowMapKeys
- Maps the keys of an object to new keys.
Geometry
getDistanceBetweenPoints
- Returns the distance between two points on a cartesian plane.
Phone Numbers
isValidIndianMobileNumber
- Checks if a number is a valid Indian mobile number.getTenDigitIndianMobileNumber
- Returns a vaild 10 digit Indian mobile number from a given string or returnsnull
.
Colors
Utilities that make working with colors easier in Tailwind CSS.
getColorVarsObj
- Returns an object with CSS variables names as keys and CSS colors as values.getColorVarsCSS
- Returns an object of the form{':root': ColorVarsObj, '.dark'? : ColorVarsObj}
.getCSSVarsColorObj
- Returns a color object where the values are CSS variables.getRadixColorObj
- Returns a color object with Radix UI color values.getRadixColorsForTailwind
- Returns a color object with Radix UI color values, and, base CSS which exposes the color values as CSS vars.getFreshworksColorsForTailwind
- Returns a color object with Freshworks' 'Crayon' design system color values.
DOM
moveCursorWithinInput
- Moves the user's cursor to the desired position within a text input.