Releases: bnidev/js-utils
Releases · bnidev/js-utils
v0.3.0
✨ Features
- DOM: Add
onOrientationChangeutility to listen for device orientation changes (#28) (929622d) - DOM: Add
onResizeutility with support forwindow,document, andHTMLElementresize (#28) (929622d) - String: Add
escapeHtmlutility to escape special HTML characters (#27) (5ac2432) - Sanitize: Add
sanitizeJsonutility for safe JSON parsing (#22) (3b15f92) - Sanitize: Add
sanitizeHtmlutility for rich-text HTML cleaning (#22) (3b15f92) - Sanitize: Add
sanitizeUrlutility with protocol allowlist (#22) (3b15f92)
v0.2.0
✨ Features
- DOM: Accept both CSS selector strings and HTMLElements as input (all utilities) (#19) (d6149dc)
- DOM: Add
onScrollCompletecallback and error handling inscrollToElementAfterRender(#19) (d6149dc) - DOM: Return
nullor empty array when elements are not found (getElementDimensions,getFocusableElements,isElementInViewport) (#19) (d6149dc) - DOM: Return an object in
focusElementto provide useful feedback and enable follow-up handling (#19) (d6149dc) - DOM: Add error handling and return error in
focusElementiffocus()throws (#19) (d6149dc) - Math: Add
degreesToRadiansandradiansToDegreesutilities to convert between degrees and radians (#18) (0114415) - Math: Add
haversineDistanceutility to calculate the distance between two geographic coordinates (#18) (0114415) - Math: Add
distanceutility to calculate the distance between two points (#18) (0114415) - Math: Add
pointInCircleutility to check whether a point lies inside or on the boundary of a circle (#18) (0114415) - String:
stripHtmlTagsnow supports an optionalmaxLengthparameter to mitigate regex denial-of-service (ReDoS) risks (#17) (ec109d1)
🛠️ Fixes
v0.1.0
✨ Features
- Array: Add
chunkArrayutility to split an array into chunks (#7) (1eb48e3) - Array: Add
compactArrayutility to remove falsy values from an array (#7) (1eb48e3) - Array: Add
differenceArray,intersectionArray, anduniqueArrayutilities for array set operations (#7) (1eb48e3) - Array: Add
shuffleArrayutility to shuffle an array (#7) (1eb48e3) - Async: Add
retryAsyncFnutility to retry an async function with exponential backoff (#6) (a73eedc) - Async: Add
timeoutAsyncFnutility to run an async function with a timeout (#6) (a73eedc) - Async: Add
waitutility to create a delay (#6) (a73eedc) - DOM: Add utilities:
getElementDimensions,getFocusableElements,isElementInViewport,loadModules,toggleScrollLock, andwaitForElementRemoved(#11) (c5c7f47) - DOM: Expand
waitForVisibleElementto accept a CSS selector or anHTMLElement(#11) (c5c7f47) - Object: Add
getNestedValue,mapValues,omit, andpickutilities for object manipulation (#10) (130d9dc) - String: Add
capitalize,stripHtmlTags, andtruncateutilities for string manipulation (#9) (2fbb25c) - Timing: Add
everyNthCallutility to invoke a function every Nth time it's called (#12) (7af2d86) - Timing: Add
intervalFnutility for managing interval timers with cancel support (#12) (7af2d86) - Validation: Add
isEmail,isEqual, andisUrlutilities for data validation (#8) (3766f07)
🧪 Tests
🏡 Chores
- Set up
vitestconfiguration with coverage reporting (#4) (6759b42) - Add
changeset-formatterto improve changelog formatting (#13) (88c9c4c)
🤖 CI
v0.0.1
Patch Changes
- Initial release of
@bnidev/js-utils, a collection of modern, typed JavaScript utility functions including array manipulation, DOM helpers, object utilities, and timing functions.