UNPKG

@dvcol/common-utils

Version:

Typescript library for common utility functions and constants

423 lines (185 loc) 15.7 kB
# Changelog All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. ## [1.34.0](https://github.com/dvcol/common-utils/compare/v1.33.0...v1.34.0) (2025-06-15) ### Features * **date:** adds short mode ([d18580f](https://github.com/dvcol/common-utils/commit/d18580f8bd8226aab4a2a4118df281d67dc24274)) * **element:** adds last focusable ([f0fd19e](https://github.com/dvcol/common-utils/commit/f0fd19ee2ef214edc83b0e1803df3eb54d06be4a)) ## [1.33.0](https://github.com/dvcol/common-utils/compare/v1.32.0...v1.33.0) (2025-05-31) ### Features * **date:** adds since & ago utility functions ([246c1a4](https://github.com/dvcol/common-utils/commit/246c1a4d30805debf780c1f04d2d1b7408862be4)) ## [1.32.0](https://github.com/dvcol/common-utils/compare/v1.31.2...v1.32.0) (2025-05-27) ### Features * **string:** support html in tokenizer ([733fdf2](https://github.com/dvcol/common-utils/commit/733fdf2b179429cc9ec4666576f9e2cb0bebe3a4)) ### [1.31.2](https://github.com/dvcol/common-utils/compare/v1.31.1...v1.31.2) (2025-05-21) ### Bug Fixes * **params:** fix incorrect type map ([790f448](https://github.com/dvcol/common-utils/commit/790f44842bdc5eaa77ffaa6f0bbffbbf814e1664)) ### [1.31.1](https://github.com/dvcol/common-utils/compare/v1.31.0...v1.31.1) (2025-05-17) ### Bug Fixes * **export:** rework model exports & add strict params ([bd327a7](https://github.com/dvcol/common-utils/commit/bd327a7d226cedc878b1b1123759566d88394814)) ## [1.31.0](https://github.com/dvcol/common-utils/compare/v1.30.0...v1.31.0) (2025-05-17) ### Features * **parameters:** adds custom type map ([723bfd4](https://github.com/dvcol/common-utils/commit/723bfd4ea6750f2206877b1612bfbf47f1ed9a4a)) ## [1.30.0](https://github.com/dvcol/common-utils/compare/v1.29.4...v1.30.0) (2025-05-17) ### Features * **parameters:** adds path parameters extraction ([38bebf4](https://github.com/dvcol/common-utils/commit/38bebf4305e5b1976b0eb982f156e542f2f03fc5)) ### [1.29.4](https://github.com/dvcol/common-utils/compare/v1.29.3...v1.29.4) (2025-04-17) ### Bug Fixes * **logger:** fix toLogLevel function ([ac09479](https://github.com/dvcol/common-utils/commit/ac094796c626cd4169e7e4ec65293d06bf12f1ca)) ### [1.29.3](https://github.com/dvcol/common-utils/compare/v1.29.2...v1.29.3) (2025-04-16) ### Bug Fixes * **debounce:** improve typing, fix resolve/reject & remove async cancel ([675aa4a](https://github.com/dvcol/common-utils/commit/675aa4aede842242e186d4ef34dae3e70b2accfb)) ### [1.29.2](https://github.com/dvcol/common-utils/compare/v1.29.1...v1.29.2) (2025-04-15) ### [1.29.1](https://github.com/dvcol/common-utils/compare/v1.29.0...v1.29.1) (2025-04-14) ### Bug Fixes * **logger:** fix type signatures ([83dc944](https://github.com/dvcol/common-utils/commit/83dc94497e6a3b35ddc8d0f74e532c4f8871e67e)) ## [1.29.0](https://github.com/dvcol/common-utils/compare/v1.28.0...v1.29.0) (2025-03-29) ### Features * **browser:** adds browser & mobile utils ([99cbb42](https://github.com/dvcol/common-utils/commit/99cbb42c08c2d297a8f9b9bf53eeef32e2d9a517)) ## [1.28.0](https://github.com/dvcol/common-utils/compare/v1.27.0...v1.28.0) (2025-03-26) ### Features * **element:** adds focus list getter ([7ab4924](https://github.com/dvcol/common-utils/commit/7ab49246cd4796005d9d6759bb995182f476e028)) ## [1.27.0](https://github.com/dvcol/common-utils/compare/v1.26.3...v1.27.0) (2025-03-23) ### Features * **element:** adds find closest clickable element ([1d36100](https://github.com/dvcol/common-utils/commit/1d36100bbb03730f74070f7c8e965399e4cdc5a5)) ### [1.26.3](https://github.com/dvcol/common-utils/compare/v1.26.2...v1.26.3) (2025-03-10) ### Bug Fixes * **cursor:** adds missing support for safari ([37f9591](https://github.com/dvcol/common-utils/commit/37f9591b597a6a11e4558a448068a03cfcab7dc6)) ### [1.26.2](https://github.com/dvcol/common-utils/compare/v1.26.1...v1.26.2) (2025-03-10) ### Bug Fixes * **cursor:** ignore user-select none when deciding text elements ([48eac80](https://github.com/dvcol/common-utils/commit/48eac80c8be45d1b21d16930929e0964d411483c)) ### [1.26.1](https://github.com/dvcol/common-utils/compare/v1.26.0...v1.26.1) (2025-03-09) ## [1.26.0](https://github.com/dvcol/common-utils/compare/v1.25.0...v1.26.0) (2025-03-09) ### Features * **cursor:** adds cursor & element utils ([ea9e45e](https://github.com/dvcol/common-utils/commit/ea9e45ebb4907f5021a88a2d9a77c049e8907626)) ## [1.25.0](https://github.com/dvcol/common-utils/compare/v1.24.1...v1.25.0) (2025-03-04) ### Features * **debounce:** adds cancellation to debounce ([791524f](https://github.com/dvcol/common-utils/commit/791524f8c3d7db899492b69a6c69d078889d9249)) ### [1.24.1](https://github.com/dvcol/common-utils/compare/v1.24.0...v1.24.1) (2025-03-03) ### Bug Fixes * **touch:** fix typo in scroll diff calculation ([d6cc7c6](https://github.com/dvcol/common-utils/commit/d6cc7c628f5b3d9c3e114c97b855054065b05ab5)) ## [1.24.0](https://github.com/dvcol/common-utils/compare/v1.23.1...v1.24.0) (2025-03-03) ### Features * **touch:** rework touch handler & add scroll ignore ([5c07cf9](https://github.com/dvcol/common-utils/commit/5c07cf9be758d61fef893113d310dc793091e6ed)) ### [1.23.1](https://github.com/dvcol/common-utils/compare/v1.23.0...v1.23.1) (2025-02-14) ### Bug Fixes * **math:** adds default total to percents ([04577d1](https://github.com/dvcol/common-utils/commit/04577d1dd87633ca50064e0b12955f270c5fb149)) ## [1.23.0](https://github.com/dvcol/common-utils/compare/v1.22.0...v1.23.0) (2025-02-14) ### Features * **math:** adds math percent utility ([91fa723](https://github.com/dvcol/common-utils/commit/91fa723afacaa364b1c0ca6cada9673a1daa6c95)) ## [1.22.0](https://github.com/dvcol/common-utils/compare/v1.21.3...v1.22.0) (2025-01-31) ### Features * **math:** adds random int util ([69e382a](https://github.com/dvcol/common-utils/commit/69e382a4faeadea3af30ba2a5a1cebc4f28fbfce)) ### [1.21.3](https://github.com/dvcol/common-utils/compare/v1.21.2...v1.21.3) (2025-01-28) ### [1.21.2](https://github.com/dvcol/common-utils/compare/v1.21.1...v1.21.2) (2025-01-26) ### Bug Fixes * **class:** export type signature ([b9a412d](https://github.com/dvcol/common-utils/commit/b9a412dbffd033f7d8d73a7af47ad16ca64560ea)) ### [1.21.1](https://github.com/dvcol/common-utils/compare/v1.21.0...v1.21.1) (2025-01-26) ### Bug Fixes * **string:** remove leading separators ([1bafefc](https://github.com/dvcol/common-utils/commit/1bafefcd9f4ff16529599704a640ccd47e58b9af)) ## [1.21.0](https://github.com/dvcol/common-utils/compare/v1.20.0...v1.21.0) (2025-01-26) ### Features * **class:** add support for more formats ([8b32db6](https://github.com/dvcol/common-utils/commit/8b32db6e3f6d7d31b932ef5219293b567d5fd998)) ## [1.20.0](https://github.com/dvcol/common-utils/compare/v1.19.0...v1.20.0) (2025-01-17) ### Features * **math:** adds clamp util ([4647f81](https://github.com/dvcol/common-utils/commit/4647f81c4c706fb016218f0ae64113c1092a20b0)) ## [1.19.0](https://github.com/dvcol/common-utils/compare/v1.18.3...v1.19.0) (2024-12-25) ### Features * **class:** adds class & style merger ([acab2d6](https://github.com/dvcol/common-utils/commit/acab2d69684394f807e0e4a6b093e8d565a219f4)) ### [1.18.3](https://github.com/dvcol/common-utils/compare/v1.18.2...v1.18.3) (2024-11-11) ### [1.18.2](https://github.com/dvcol/common-utils/compare/v1.18.1...v1.18.2) (2024-11-11) ### Bug Fixes * **debounce:** resolves/rejects debounced calls ([ddae086](https://github.com/dvcol/common-utils/commit/ddae08685a65116a76a6fc93a7f67c6fd63bcffa)) ### [1.18.1](https://github.com/dvcol/common-utils/compare/v1.18.0...v1.18.1) (2024-10-25) ### Bug Fixes * **debounce:** reject promise on error ([5e3e4f7](https://github.com/dvcol/common-utils/commit/5e3e4f7c1816ba192e5a11433aafb78e1aabe915)) ## [1.18.0](https://github.com/dvcol/common-utils/compare/v1.17.2...v1.18.0) (2024-10-24) ### Features * **color:** adds colors conversion utils ([2946215](https://github.com/dvcol/common-utils/commit/29462156793d63c92e73e7d6ae3b17b8936b0eb2)) ### [1.17.2](https://github.com/dvcol/common-utils/compare/v1.17.1...v1.17.2) (2024-10-05) ### Bug Fixes * **logger:** adds missing silent enum log level ([1f6477e](https://github.com/dvcol/common-utils/commit/1f6477e7e2de6c5c1a9859a1829ed0c4f91ec8b9)) * **logger:** adds trace as log level ([347f2cc](https://github.com/dvcol/common-utils/commit/347f2cc6ea68cd5bdf43f5ac3fbf08abaec28d27)) ### [1.17.1](https://github.com/dvcol/common-utils/compare/v1.17.0...v1.17.1) (2024-09-30) ### Bug Fixes * **object:** return eqeq when depth is <= 0 ([2fd110e](https://github.com/dvcol/common-utils/commit/2fd110e81c9de2d8d5fb5411672d16c41236ebaf)) ## [1.17.0](https://github.com/dvcol/common-utils/compare/v1.16.1...v1.17.0) (2024-09-23) ### Features * **object:** adds shallow equal utility ([99d6459](https://github.com/dvcol/common-utils/commit/99d6459c10ec0d3db63cc282524bedc69b726b29)) ### [1.16.1](https://github.com/dvcol/common-utils/compare/v1.16.0...v1.16.1) (2024-09-20) ### Bug Fixes * **exports:** add publint and fix exports ([2032022](https://github.com/dvcol/common-utils/commit/20320228b61352c83618e9ebec4baf1ca118ea74)) ## [1.16.0](https://github.com/dvcol/common-utils/compare/v1.15.1...v1.16.0) (2024-09-20) ### Features * **utils:** adds object, touch and string utils ([0b081c4](https://github.com/dvcol/common-utils/commit/0b081c485adb2d04516cd2eed12a186126c13de2)) ### [1.15.1](https://github.com/dvcol/common-utils/compare/v1.15.0...v1.15.1) (2024-09-16) ### Bug Fixes * **promises:** remove unnecessary async ([c35bec5](https://github.com/dvcol/common-utils/commit/c35bec52d7afa37c1b3ebf4a1ba95a4d55c1e4e3)) ## [1.15.0](https://github.com/dvcol/common-utils/compare/v1.14.2...v1.15.0) (2024-09-16) ### Features * **promise:** adds raceUntil function ([60bc22e](https://github.com/dvcol/common-utils/commit/60bc22e94e6f95994f6f579661a365a65a19a4e7)) ### [1.14.2](https://github.com/dvcol/common-utils/compare/v1.14.1...v1.14.2) (2024-09-02) ### Bug Fixes * **types:** export SaveFilePickerOptions ([16f8223](https://github.com/dvcol/common-utils/commit/16f8223c533f43e547e9618c268255f082f064c2)) ### [1.14.1](https://github.com/dvcol/common-utils/compare/v1.14.0...v1.14.1) (2024-08-26) ### Bug Fixes * **cache:** fix type error in cache store model ([5b889e6](https://github.com/dvcol/common-utils/commit/5b889e6350c5a5aa5ac25e30bbb51ea08bc25df6)) ## [1.14.0](https://github.com/dvcol/common-utils/compare/v1.13.1...v1.14.0) (2024-08-26) ### Features * **cache:** adds access and retention logging toggles ([8d89d00](https://github.com/dvcol/common-utils/commit/8d89d002c34a8674b97406a5fd14792ecd36505e)) ### [1.13.1](https://github.com/dvcol/common-utils/compare/v1.13.0...v1.13.1) (2024-08-26) ### Bug Fixes * **cache:** makes values, keys and entries allow Promise ([f773c03](https://github.com/dvcol/common-utils/commit/f773c038e37647d212e4a52a39bf3389be405009)) ## [1.13.0](https://github.com/dvcol/common-utils/compare/v1.12.0...v1.13.0) (2024-08-26) ### Features * **cache:** adds additional methods to cache store ([c760c6e](https://github.com/dvcol/common-utils/commit/c760c6e526a8f741d94254bb128f1cd08183acac)) ## [1.12.0](https://github.com/dvcol/common-utils/compare/v1.11.2...v1.12.0) (2024-08-25) ### Features * **cache:** adds optional eviction date in cache store entity ([18da2a5](https://github.com/dvcol/common-utils/commit/18da2a57668dd8111db5e72933eb46d34520d4c7)) ### [1.11.2](https://github.com/dvcol/common-utils/compare/v1.11.1...v1.11.2) (2024-08-23) ### Bug Fixes * **format:** round seconds to integers ([913b003](https://github.com/dvcol/common-utils/commit/913b003e5f26a668f65278f21b23d08e2aa109d6)) ### [1.11.1](https://github.com/dvcol/common-utils/compare/v1.11.0...v1.11.1) (2024-08-14) ### Bug Fixes * **format:** adds a days only option to avoid approximation ([e96f414](https://github.com/dvcol/common-utils/commit/e96f414500aaaf156f8bc2df8f0c50b360a0dd1b)) ## [1.11.0](https://github.com/dvcol/common-utils/compare/v1.10.0...v1.11.0) (2024-08-14) ### Features * **format:** adds support to year-month-date in time formatting ([e4f1b77](https://github.com/dvcol/common-utils/commit/e4f1b776f16bee2e81e11c266e7b105bee059305)) ## [1.10.0](https://github.com/dvcol/common-utils/compare/v1.9.0...v1.10.0) (2024-08-11) ### Features * **crypto:** adds crypto utils ([a1ba4a2](https://github.com/dvcol/common-utils/commit/a1ba4a2e594741bec6fafaefc781c7228ef3190a)) ## [1.9.0](https://github.com/dvcol/common-utils/compare/v1.8.0...v1.9.0) (2024-08-09) ### Features * **date:** add a util to get today's date in local iso ([e2e5482](https://github.com/dvcol/common-utils/commit/e2e548231250bae6e3c7d9776c9ea2d5099758f3)) ## [1.8.0](https://github.com/dvcol/common-utils/compare/v1.7.0...v1.8.0) (2024-08-09) ### Features * **date:** adds small day o the week date util ([663ec34](https://github.com/dvcol/common-utils/commit/663ec347f069c23ac50af49f446abb28fa557aad)) ## [1.7.0](https://github.com/dvcol/common-utils/compare/v1.6.0...v1.7.0) (2024-08-04) ### Features * **intl:** creates intl util ([e84f8d1](https://github.com/dvcol/common-utils/commit/e84f8d1ebd0ee22cbd4b15275fbd35cb4759a653)) * **logger:** rework logger and add colorize options ([a6a6c42](https://github.com/dvcol/common-utils/commit/a6a6c427a0c88d6d56a88b87ae74d450619eaf21)) * **navigator:** adds style & navigator utils ([5a1d3ef](https://github.com/dvcol/common-utils/commit/5a1d3ef9fd730d07e9a098fba015e8799460d3c2)) * **promise:** create promise util ([2bb14e2](https://github.com/dvcol/common-utils/commit/2bb14e25af70ce5217fd7f0c7694b89182ae7c1b)) ## [1.6.0](https://github.com/dvcol/common-utils/compare/v1.5.0...v1.6.0) (2024-07-22) ### Features * **window:** adds watch utility for theme modes ([899961b](https://github.com/dvcol/common-utils/commit/899961b15ffe07ef8e6e7c35a91267f6b5010dfb)) ## [1.5.0](https://github.com/dvcol/common-utils/compare/v1.4.0...v1.5.0) (2024-07-22) ### Features * **window:** adds isLightTheme utility function ([bc0f6fd](https://github.com/dvcol/common-utils/commit/bc0f6fd4b8e68915800de71dcfd785d4483b3f31)) ## [1.4.0](https://github.com/dvcol/common-utils/compare/v1.3.0...v1.4.0) (2024-07-17) ### Features * **format:** add formatting utils ([a15eace](https://github.com/dvcol/common-utils/commit/a15eace5658dda342de130ea9975e48d30dd34d8)) ## [1.3.0](https://github.com/dvcol/common-utils/compare/v1.2.2...v1.3.0) (2024-07-13) ### Features * **save:** adds file save utils (mostly chromium browsers) ([a6a3f93](https://github.com/dvcol/common-utils/commit/a6a3f9300f33df8ec401c5cc8bd1da7d75f7bb94)) ### [1.2.2](https://github.com/dvcol/common-utils/compare/v1.2.1...v1.2.2) (2024-06-13) ### Bug Fixes * **build:** exclude specs file from published dist ([3115db7](https://github.com/dvcol/common-utils/commit/3115db722367f2eeaf1b795b67c068ceb8647141)) ### [1.2.1](https://github.com/dvcol/common-utils/compare/v1.2.0...v1.2.1) (2024-06-13) ### Bug Fixes * **http:** add missing export ([aced6d8](https://github.com/dvcol/common-utils/commit/aced6d8e0e5b7a02268f23d5fcbccb18821dac92)) ## [1.2.0](https://github.com/dvcol/common-utils/compare/v1.1.0...v1.2.0) (2024-06-13) ### Features * **logger:** adds static logger ([e8615cd](https://github.com/dvcol/common-utils/commit/e8615cd96c05bd386d185d31f5e3f8d6ae867024)) ## 1.1.0 (2024-06-13) ### Features * initial commit ([ec93ad0](https://github.com/dvcol/common-utils/commit/ec93ad02e5b8e10ab6223259ccdc13bd1cbd9418))