diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index 1ab5fb6..464a549 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -20,7 +20,7 @@ jobs: uses: actions/checkout@v6 - name: Setup pnpm - uses: pnpm/action-setup@v4 + uses: pnpm/action-setup@v6 - name: Use Node.js uses: actions/setup-node@v6 diff --git a/.github/workflows/pr-commit-messages.yml b/.github/workflows/pr-commit-messages.yml index 45856a6..9f0d1e9 100644 --- a/.github/workflows/pr-commit-messages.yml +++ b/.github/workflows/pr-commit-messages.yml @@ -17,7 +17,7 @@ jobs: fetch-depth: 0 - name: Setup pnpm - uses: pnpm/action-setup@v4 + uses: pnpm/action-setup@v6 - name: Use Node.js uses: actions/setup-node@v6 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index adf3501..3dd1dbf 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -27,7 +27,7 @@ jobs: fetch-depth: 0 - name: Setup pnpm - uses: pnpm/action-setup@v4 + uses: pnpm/action-setup@v6 - name: Use Node.js uses: actions/setup-node@v6 diff --git a/package.json b/package.json index 40f21c8..5d6c2a1 100644 --- a/package.json +++ b/package.json @@ -85,14 +85,14 @@ }, "prettier": "@webdeveric/prettier-config", "devDependencies": { - "@commitlint/config-conventional": "^20.5.0", + "@commitlint/config-conventional": "^20.5.3", "@commitlint/types": "^20.5.0", "@types/node": "^24.12.2", - "@typescript/native-preview": "7.0.0-dev.20260429.1", + "@typescript/native-preview": "7.0.0-dev.20260502.1", "@vitest/coverage-v8": "^4.1.5", "@webdeveric/eslint-config-ts": "^0.12.0", "@webdeveric/prettier-config": "^0.4.0", - "commitlint": "^20.5.2", + "commitlint": "^20.5.3", "commitlint-plugin-cspell": "^0.8.0", "conventional-changelog-conventionalcommits": "^9.3.1", "cspell": "^10.0.0", @@ -101,7 +101,7 @@ "eslint-import-resolver-typescript": "^4.4.4", "eslint-plugin-import": "^2.32.0", "husky": "^9.1.7", - "jsdom": "^29.1.0", + "jsdom": "^29.1.1", "lint-staged": "^16.4.0", "prettier": "^3.8.3", "rimraf": "^6.1.3", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 9bb6d90..057c4fb 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -9,8 +9,8 @@ importers: .: devDependencies: '@commitlint/config-conventional': - specifier: ^20.5.0 - version: 20.5.0 + specifier: ^20.5.3 + version: 20.5.3 '@commitlint/types': specifier: ^20.5.0 version: 20.5.0 @@ -18,8 +18,8 @@ importers: specifier: ^24.12.2 version: 24.12.2 '@typescript/native-preview': - specifier: 7.0.0-dev.20260429.1 - version: 7.0.0-dev.20260429.1 + specifier: 7.0.0-dev.20260502.1 + version: 7.0.0-dev.20260502.1 '@vitest/coverage-v8': specifier: ^4.1.5 version: 4.1.5(vitest@4.1.5) @@ -30,11 +30,11 @@ importers: specifier: ^0.4.0 version: 0.4.0(prettier@3.8.3) commitlint: - specifier: ^20.5.2 - version: 20.5.2(@types/node@24.12.2)(conventional-commits-filter@5.0.0)(conventional-commits-parser@6.4.0)(typescript@6.0.3) + specifier: ^20.5.3 + version: 20.5.3(@types/node@24.12.2)(conventional-commits-filter@5.0.0)(conventional-commits-parser@6.4.0)(typescript@6.0.3) commitlint-plugin-cspell: specifier: ^0.8.0 - version: 0.8.0(@commitlint/lint@20.5.0) + version: 0.8.0(@commitlint/lint@20.5.3) conventional-changelog-conventionalcommits: specifier: ^9.3.1 version: 9.3.1 @@ -57,8 +57,8 @@ importers: specifier: ^9.1.7 version: 9.1.7 jsdom: - specifier: ^29.1.0 - version: 29.1.0 + specifier: ^29.1.1 + version: 29.1.1 lint-staged: specifier: ^16.4.0 version: 16.4.0 @@ -76,7 +76,7 @@ importers: version: 0.24.0 vitest: specifier: ^4.1.5 - version: 4.1.5(@types/node@24.12.2)(@vitest/coverage-v8@4.1.5)(jsdom@29.1.0)(vite@8.0.10(@types/node@24.12.2)(jiti@2.6.1)(yaml@2.8.3)) + version: 4.1.5(@types/node@24.12.2)(@vitest/coverage-v8@4.1.5)(jsdom@29.1.1)(vite@8.0.10(@types/node@24.12.2)(jiti@2.6.1)(yaml@2.8.4)) packages: @@ -119,8 +119,8 @@ packages: resolution: {integrity: sha512-qSs4ifwzKJSV39ucNjsvc6WVHs6b7S03sOh2OcHF9UHfVPqWWALUsNUVzhSBiItjRZoLHx7nIarVjqKVusUZ1Q==} engines: {node: '>=6.9.0'} - '@babel/parser@7.29.2': - resolution: {integrity: sha512-4GgRzy/+fsBa72/RZVJmGKPmZu9Byn8o4MoLpmNe1m8ZfYnz5emHLQz3U4gLud6Zwl0RZIcgiLD7Uq7ySFuDLA==} + '@babel/parser@7.29.3': + resolution: {integrity: sha512-b3ctpQwp+PROvU/cttc4OYl4MzfJUWy6FZg+PMXfzmt/+39iHVF0sDfqay8TQM3JA2EUOyKcFZt75jWriQijsA==} engines: {node: '>=6.0.0'} hasBin: true @@ -140,21 +140,21 @@ packages: resolution: {integrity: sha512-ooWCrlZP11i8GImSjTHYHLkvFDP48nS4+204nGb1RiX/WXYHmJA2III9/e2DWVabCESdW7hBAEzHRqUn9OUVvQ==} engines: {node: '>=0.1.90'} - '@commitlint/cli@20.5.2': - resolution: {integrity: sha512-IXr5xd3IX8SEG936P8gcpozRplkDeDSwJlt8UvoY1winwIy2udTbQ/cOCgbaaxcjdDqVoS29VUcz/wkwnSozbA==} + '@commitlint/cli@20.5.3': + resolution: {integrity: sha512-OJdL0EXWD5y9LPa0nr/geOwzaS8BsdaybKkcloB0JgsguGxNv2R+hC2FTPqrAcprg35zF33KOQerY0x8W1aesA==} engines: {node: '>=v18'} hasBin: true - '@commitlint/config-conventional@20.5.0': - resolution: {integrity: sha512-t3Ni88rFw1XMa4nZHgOKJ8fIAT9M2j5TnKyTqJzsxea7FUetlNdYFus9dz+MhIRZmc16P0PPyEfh6X2d/qw8SA==} + '@commitlint/config-conventional@20.5.3': + resolution: {integrity: sha512-j34Qqeaa152chJgz2ysyk0BCpHenJn1lV0Rx0VXf8k3ccQcED+48EZrzMvo9jLmJUyBrrBwvu89I+2er4gW7QQ==} engines: {node: '>=v18'} '@commitlint/config-validator@20.5.0': resolution: {integrity: sha512-T/Uh6iJUzyx7j35GmHWdIiGRQB+ouZDk0pwAaYq4SXgB54KZhFdJ0vYmxiW6AMYICTIWuyMxDBl1jK74oFp/Gw==} engines: {node: '>=v18'} - '@commitlint/ensure@20.5.0': - resolution: {integrity: sha512-IpHqAUesBeW1EDDdjzJeaOxU9tnogLAyXLRBn03SHlj1SGENn2JGZqSWGkFvBJkJzfXAuCNtsoYzax+ZPS+puw==} + '@commitlint/ensure@20.5.3': + resolution: {integrity: sha512-4i4AgNvH62owG9MwSiWKrle7HGNpBHHdLnWFIp5fTsHUYe5kRuh15t08L/0pdbbrRk8JKXQxxN4hZQcn+szkrw==} engines: {node: '>=v18'} '@commitlint/execute-rule@20.0.0': @@ -169,12 +169,12 @@ packages: resolution: {integrity: sha512-JWLarAsurHJhPozbuAH6GbP4p/hdOCoqS9zJMfqwswne+/GPs5V0+rrsfOkP68Y8PSLphwtFXV0EzJ+GTXTTGg==} engines: {node: '>=v18'} - '@commitlint/lint@20.5.0': - resolution: {integrity: sha512-jiM3hNUdu04jFBf1VgPdjtIPvbuVfDTBAc6L98AWcoLjF5sYqkulBHBzlVWll4rMF1T5zeQFB6r//a+s+BBKlA==} + '@commitlint/lint@20.5.3': + resolution: {integrity: sha512-M7JbWBNr2gXKaPc4i/KipsuW1gkDHpj35KPjWtKy3Z+2AQw5wu1gBi1LIO0uoaij67CqY4K8PxPZSGens4evCw==} engines: {node: '>=v18'} - '@commitlint/load@20.5.2': - resolution: {integrity: sha512-zmr0RGDz7vThxW1I8ohb9yBjnGuH9mqwJpn21hInjGla+IlLOkS9ey0+dD5HlkzFlY0lX2NYdA2lDW6/0rO7Gw==} + '@commitlint/load@20.5.3': + resolution: {integrity: sha512-1FDZWuKyu98Myb8i7Tp31jPU2rZpOwAdYRyJcy2KoGg7Xk2A+bgHN8smhMaaNSNkmE8fwt53BokywZq8Gv/5XQ==} engines: {node: '>=v18'} '@commitlint/message@20.4.3': @@ -189,12 +189,12 @@ packages: resolution: {integrity: sha512-JDEIJ2+GnWpK8QqwfmW7O42h0aycJEWNqcdkJnyzLD11nf9dW2dWLTVEa8Wtlo4IZFGLPATjR5neA5QlOvIH1w==} engines: {node: '>=v18'} - '@commitlint/resolve-extends@20.5.2': - resolution: {integrity: sha512-8EhSCU9eNos/5cI1yg64GW79UH1c64O69AfStCsj4zqy6An/qIphVEXj4/+2M6056T8coz00f+UXFn4WUUP1HQ==} + '@commitlint/resolve-extends@20.5.3': + resolution: {integrity: sha512-+ogW9v/u9JqpvAgTrLra/YTFo0KkjU6iNblF89pPsj4NebNc+DAWctsludwezI8YnsjBmfHpApSwcXprN/f/ew==} engines: {node: '>=v18'} - '@commitlint/rules@20.5.0': - resolution: {integrity: sha512-5NdQXQEdnDPT5pK8O39ZA7HohzPRHEsDGU23cyVCNPQy4WegAbAwrQk3nIu7p2sl3dutPk8RZd91yKTrMTnRkQ==} + '@commitlint/rules@20.5.3': + resolution: {integrity: sha512-MPlMnb9D3wbszYMp+1hPtuhtPJndRo6I6yfkZVA4+jR8w7Kqp0u2u/Y+gzbaItx5Lltq5rw7FSZQWJMoXUC4NQ==} engines: {node: '>=v18'} '@commitlint/to-lines@20.0.0': @@ -966,50 +966,50 @@ packages: resolution: {integrity: sha512-LdDNl6C5iJExcM0Yh0PwAIBb9PrSiCsWamF/JyEZawm3kFDnRoaq3LGE4bpyRao/fWeGKKyw7icx0YxrLFC5Cg==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - '@typescript/native-preview-darwin-arm64@7.0.0-dev.20260429.1': - resolution: {integrity: sha512-+Rl8iPf+vYKq0fnb8euEOJxxvE/abEOWmhdllQIe+Shd8xhS7UVi+2WunsP1GyH2Ofc+N8rGYz0/dMnhrRYEZA==} + '@typescript/native-preview-darwin-arm64@7.0.0-dev.20260502.1': + resolution: {integrity: sha512-+usfUIAClShkS8U9YGeX4v3xq7082+Nm7V38llOHYM0YMoUgMvif8u3K44mMUund5LswKjMsFLp8m96mALf7cg==} engines: {node: '>=16.20.0'} cpu: [arm64] os: [darwin] - '@typescript/native-preview-darwin-x64@7.0.0-dev.20260429.1': - resolution: {integrity: sha512-be6Y7VVJz+usdI1ifCHy5mcldpxf8KXGYoyIp8w5Rd54zUtvtkYEJJWKzV5/bJt4bsQLLcp1i0vD4KJSr06Tmg==} + '@typescript/native-preview-darwin-x64@7.0.0-dev.20260502.1': + resolution: {integrity: sha512-OqBaydzqoRYJRyQjf7mgT/txw4lDuft1ZCODg/BYMVan0npVvaYFCL4Bc6q34Gpl+jpXjanjKawZIZ34mT15UA==} engines: {node: '>=16.20.0'} cpu: [x64] os: [darwin] - '@typescript/native-preview-linux-arm64@7.0.0-dev.20260429.1': - resolution: {integrity: sha512-44amAEH/VxG6K/hrAmhiyOTnwoTzm7bj0ja7d8sV8Iuocv37oUiSB/8OgJLytLqfIh+Q6kipfTwY6Do3jh6THQ==} + '@typescript/native-preview-linux-arm64@7.0.0-dev.20260502.1': + resolution: {integrity: sha512-RTmsZnsfACiJL/wDEaFkuYtFAlAH6i8sP/nK7OJMCoiXWD3KfGnvGkTKOIL8QiJ8MqyPP9bx2qxSUUdkXtp+Bw==} engines: {node: '>=16.20.0'} cpu: [arm64] os: [linux] - '@typescript/native-preview-linux-arm@7.0.0-dev.20260429.1': - resolution: {integrity: sha512-ngN6+qt5bPdp2zzasShoT4UONGXr+tvzHdz4NjuitwhiAF/d70CseXunb4syaudl1a+lJyTHro/ALTC0hRf6vA==} + '@typescript/native-preview-linux-arm@7.0.0-dev.20260502.1': + resolution: {integrity: sha512-YJ/a1Iro3wq6DRRF9zkEAwFCZON2HMeNOlG51gAEX7BBSi0NuCeQrhF1u6YGeY8b846802u6LmV91pQenI3Jmw==} engines: {node: '>=16.20.0'} cpu: [arm] os: [linux] - '@typescript/native-preview-linux-x64@7.0.0-dev.20260429.1': - resolution: {integrity: sha512-haAOqc0fJCZkt4RDi0/ZQGBdDfpDzr2N+mEcR+FbiYQD3Y00kOK34hXSrjZafO2kq56ZDWunvCaUTCev0fJDbA==} + '@typescript/native-preview-linux-x64@7.0.0-dev.20260502.1': + resolution: {integrity: sha512-h+8GWkKtprzYm+W3J9ZGNHNmtFuxVu5sG0+d5mbfWacjOJl6z3DCb2U9/mAbx28fqbvIO/CwSYPoKkP5D03Ppg==} engines: {node: '>=16.20.0'} cpu: [x64] os: [linux] - '@typescript/native-preview-win32-arm64@7.0.0-dev.20260429.1': - resolution: {integrity: sha512-J5O0tGVGqOZHbqm9ijRnZ5ADfPqYTjFIwZtYKpQL1yj1dZnUzMszO8P3bnOSfYD//DJhZINQyJzpPJxu29uiwQ==} + '@typescript/native-preview-win32-arm64@7.0.0-dev.20260502.1': + resolution: {integrity: sha512-3FU/YiNyILvs7chIUUDYTT3i3jxL1gegSPB+pKEhpgw+rxa6B9ZSobbYZN4tetBrzgFpfeCRe0ZgGVdPzxVq2A==} engines: {node: '>=16.20.0'} cpu: [arm64] os: [win32] - '@typescript/native-preview-win32-x64@7.0.0-dev.20260429.1': - resolution: {integrity: sha512-/OZ99Hi/32huvZQ5fdqTwqLvZtKC3QrCXmLuKfMyVuBisV/TSd6LhlFQLolvIpr7/E530mnFZ4sXjgDEzVFqAw==} + '@typescript/native-preview-win32-x64@7.0.0-dev.20260502.1': + resolution: {integrity: sha512-7+0ii6rRk1Tr/r6a3TPdo5xLfPDwyGTqGBlOGbIwVI8cJ32FFcBNXtNVy14EU0zoS/EyQybGLe09U53G2hMFsw==} engines: {node: '>=16.20.0'} cpu: [x64] os: [win32] - '@typescript/native-preview@7.0.0-dev.20260429.1': - resolution: {integrity: sha512-SGKnvs5EA+V1spnraYJqum/lEajE0IQ2bVVPC72hFfWjoCfQ6N7iVYxLUGreiE3VFyQWWQBPgXZrRUFnawVvpQ==} + '@typescript/native-preview@7.0.0-dev.20260502.1': + resolution: {integrity: sha512-7G2S9N2HFA1L0Nug8shs3yHAq9yRrlJkc5wSeaCq5rPDdGbRU0hpb02Gti87Ulb3noqcJAkiStXm/H804dIu8Q==} engines: {node: '>=16.20.0'} hasBin: true @@ -1428,8 +1428,8 @@ packages: peerDependencies: '@commitlint/lint': '>=7.6.0' - commitlint@20.5.2: - resolution: {integrity: sha512-/KQmCk8xOs2QhxWq+wB3+fnYxHo04Q0VBVdC48fnPZnnuidpD01JhY10nc0oV99w7MQwkA2sTE3rgN/2379kEA==} + commitlint@20.5.3: + resolution: {integrity: sha512-bOCv+6p4QLfATtM35+I3lt1r6aWC9hl0jp9JV6mE1BOq6Kz+WHX91Dve9nl/TsMMxCbJg30dUXUx65JszhAH2w==} engines: {node: '>=v18'} hasBin: true @@ -1694,6 +1694,9 @@ packages: resolution: {integrity: sha512-w+5mJ3GuFL+NjVtJlvydShqE1eN3h3PbI7/5LAsYJP/2qtuMXjfL2LpHSRqo4b4eSF5K/DH1JXKUAHSB2UW50g==} engines: {node: '>= 0.4'} + es-toolkit@1.46.1: + resolution: {integrity: sha512-5eNtXOs3tbfxXOj04tjjseeWkRWaoCjdEI+96DgwzZoe6c9juL49pXlzAFTI72aWC9Y8p7168g6XIKjh7k6pyQ==} + escalade@3.2.0: resolution: {integrity: sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==} engines: {node: '>=6'} @@ -2082,8 +2085,8 @@ packages: resolution: {integrity: sha512-puUZAUKT5m8Zzvs72XWy3HtvVbTWljRE66cP60bxJzAqf2DgICo7lYTY2IHUmLnNpjYvw5bvmoHvPc0QO2a62w==} engines: {node: ^16.14.0 || >=18.0.0} - hosted-git-info@9.0.2: - resolution: {integrity: sha512-M422h7o/BR3rmCQ8UHi7cyyMqKltdP9Uo+J2fXK+RSAY+wTcKOIRyhTuKv4qn+DJf3g+PL890AzId5KZpX+CBg==} + hosted-git-info@9.0.3: + resolution: {integrity: sha512-Hc+ghLoSt6QaYZUv0WBiIvmMDZuZZ7oaDvdH8MbfOO4lOsxdXLEvuC6ePoGs9H1X9oCLyq6+NVN0MKqD+ydxyg==} engines: {node: ^20.17.0 || >=22.9.0} html-encoding-sniffer@6.0.0: @@ -2182,8 +2185,8 @@ packages: resolution: {integrity: sha512-2dYz766i9HprMBasCMvHMuazJ7u4WzhJwo5kb3iPSiW/iRYV6uPari3zHoqZlnuaR7V1bEiNMxikhp37rdBXbw==} engines: {node: '>=12'} - ip-address@10.1.1: - resolution: {integrity: sha512-1FMu8/N15Ck1BL551Jf42NYIoin2unWjLQ2Fze/DXryJRl5twqtwNHlO39qERGbIOcKYWHdgRryhOC+NG4eaLw==} + ip-address@10.2.0: + resolution: {integrity: sha512-/+S6j4E9AHvW9SWMSEY9Xfy66O5PWvVEJ08O0y5JGyEKQpojb0K0GKpz/v5HJ/G0vi3D2sjGK78119oXZeE0qA==} engines: {node: '>= 12'} is-array-buffer@3.0.5: @@ -2344,8 +2347,8 @@ packages: resolution: {integrity: sha512-FFUtZMpoZ8RqHS3XeXEmHWLA4thH+ZxCv2lOiPIn1Xc7CxrqhWzNSDzD+/chS/zbYezmiwWLdQC09JdQKmthOw==} engines: {node: '>=20'} - issue-parser@7.0.1: - resolution: {integrity: sha512-3YZcUUR2Wt1WsapF+S/WiA2WmlW0cWAoPccMqne7AxEBhCdFeTPjfv/Axb8V2gyCgY3nRw+ksZ3xSUX+R47iAg==} + issue-parser@7.0.2: + resolution: {integrity: sha512-7atWPjhGEIX3JEtMrOYd8TKzboYlq+5sNbdl9POiLYOI14G5HZiQbZP0Xj5EZdrufQVXfJlpTV0hys0CuxwxZw==} engines: {node: ^18.17 || >=20.6.1} istanbul-lib-coverage@3.2.2: @@ -2378,8 +2381,8 @@ packages: resolution: {integrity: sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA==} hasBin: true - jsdom@29.1.0: - resolution: {integrity: sha512-YNUc7fB9QuvSSQWfrH0xF+TyABkxUwx8sswgIDaCrw4Hol8BghdZDkITtZheRJeMtzWlnTfsM3bBBusRvpO1wg==} + jsdom@29.1.1: + resolution: {integrity: sha512-ECi4Fi2f7BdJtUKTflYRTiaMxIB0O6zfR1fX0GXpUrf6flp8QIYn1UT20YQqdSOfk2dfkCwS8LAFoJDEppNK5Q==} engines: {node: ^20.19.0 || ^22.13.0 || >=24.0.0} peerDependencies: canvas: ^3.0.0 @@ -2540,9 +2543,6 @@ packages: lodash-es@4.18.1: resolution: {integrity: sha512-J8xewKD/Gk22OZbhpOVSwcs60zhd95ESDwezOFuA3/099925PdHJ7OFHNTGtajL3AlZkykD32HykiMo+BIBI8A==} - lodash.camelcase@4.3.0: - resolution: {integrity: sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA==} - lodash.capitalize@4.2.1: resolution: {integrity: sha512-kZzYOKspf8XVX5AvmQF94gQW0lejFVgb80G85bU4ZWzoJ6C03PQg3coYAUpSTpQWelrZELd3XWgHzw4Ck5kaIw==} @@ -2555,27 +2555,12 @@ packages: lodash.isstring@4.0.1: resolution: {integrity: sha512-0wJxfxH1wgO3GrbuP+dTTk7op+6L41QCXbGINEmD+ny/G/eCqGzxyCsh7159S+mgDDcoarnBw6PC1PS5+wUGgw==} - lodash.kebabcase@4.1.1: - resolution: {integrity: sha512-N8XRTIMMqqDgSy4VLKPnJ/+hpGZN+PHQiJnSenYqPaVV/NCqEogTnAdZLQiGKhxX+JCs8waWq2t1XHWKOmlY8g==} - lodash.merge@4.6.2: resolution: {integrity: sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==} - lodash.mergewith@4.6.2: - resolution: {integrity: sha512-GK3g5RPZWTRSeLSpgP8Xhra+pnjBC56q9FZYe1d5RN3TJ35dbkGy3YqBSMbyCrlbi+CM9Z3Jk5yTL7RCsqboyQ==} - - lodash.snakecase@4.1.1: - resolution: {integrity: sha512-QZ1d4xoBHYUeuouhEq3lk3Uq7ldgyFXGBhg04+oRLnIz8o9T65Eh+8YdroUwn846zchkA9yDsDl5CVVaV2nqYw==} - - lodash.startcase@4.4.0: - resolution: {integrity: sha512-+WKqsK294HMSc2jEbNgpHpd0JfIBhp7rEV4aqXWqFr6AlXov+SlcgB1Fv01y2kGe3Gc8nMW7VA0SrGuSkRfIEg==} - lodash.uniqby@4.7.0: resolution: {integrity: sha512-e/zcLx6CSbmaEgFHCA7BnoQKyCtKMxnuWrJygbwPs/AIn+IMKl66L8/s+wBUn5LRw2pZx3bUHibiV1b6aTWIww==} - lodash.upperfirst@4.3.1: - resolution: {integrity: sha512-sReKOYJIJf74dhJONhU4e0/shzi1trVbSWDOhKYE5XV2O+H7Sb2Dihwuc7xWxVl+DgFPyTqIN3zMfT9cq5iWDg==} - log-update@6.1.0: resolution: {integrity: sha512-9ie8ItPR6tjY5uYJh8K/Zrv/RMZ5VOlOWvtZdEHYSTFKZfIBPQa9tOAEeAWhd+AnIneLJ22w5fjOYtoutpWq5w==} engines: {node: '>=18'} @@ -2695,8 +2680,8 @@ packages: mz@2.7.0: resolution: {integrity: sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q==} - nanoid@3.3.11: - resolution: {integrity: sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==} + nanoid@3.3.12: + resolution: {integrity: sha512-ZB9RH/39qpq5Vu6Y+NmUaFhQR6pp+M2Xt76XBnEwDaGcVAqhlvxrl3B2bKS5D3NH3QR76v3aSrKaF/Kiy7lEtQ==} engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} hasBin: true @@ -3062,8 +3047,8 @@ packages: resolution: {integrity: sha512-orRsuYpJVw8LdAwqqLykBj9ecS5/cRHlI5+nvTo8LcCKmzDmqVORXtOIYEEQuL9D4BxtA1lm5isAqzQZCoQ6Eg==} engines: {node: '>=4'} - postcss@8.5.12: - resolution: {integrity: sha512-W62t/Se6rA0Az3DfCL0AqJwXuKwBeYg6nOaIgzP+xZ7N5BFCI7DYi1qs6ygUYT6rvfi6t9k65UMLJC+PHZpDAA==} + postcss@8.5.13: + resolution: {integrity: sha512-qif0+jGGZoLWdHey3UFHHWP0H7Gbmsk8T5VEqyYFbWqPr1XqvLGBbk/sl8V5exGmcYJklJOhOQq1pV9IcsiFag==} engines: {node: ^10 || ^12 || >=14} prelude-ls@1.2.1: @@ -3497,11 +3482,11 @@ packages: resolution: {integrity: sha512-Bf+ILmBgretUrdJxzXM0SgXLZ3XfiaUuOj/IKQHuTXip+05Xn+uyEYdVg0kYDipTBcLrCVyUzAPz7QmArb0mmw==} engines: {node: '>=14.0.0'} - tldts-core@7.0.29: - resolution: {integrity: sha512-W99NuU7b1DcG3uJ3v9k9VztCH3WialNbBkBft5wCs8V8mexu0XQqaZEYb9l9RNNzK8+3EJ9PKWB0/RUtTQ/o+Q==} + tldts-core@7.0.30: + resolution: {integrity: sha512-uiHN8PIB1VmWyS98eZYja4xzlYqeFZVjb4OuYlJQnZAuJhMw4PbKQOKgHKhBdJR3FE/t5mUQ1Kd80++B+qhD1Q==} - tldts@7.0.29: - resolution: {integrity: sha512-JIXCerhudr/N6OWLwLF1HVsTTUo7ry6qHa5eWZEkiMuxsIiAACL55tGLfqfHfoH7QaMQUW8fngD7u7TxWexYQg==} + tldts@7.0.30: + resolution: {integrity: sha512-ELrFxuqsDdHUwoh0XxDbxuLD3Wnz49Z57IFvTtvWy1hJdcMZjXLIuonjilCiWHlT2GbE4Wlv1wKVTzDFnXH1aw==} hasBin: true to-regex-range@5.0.1: @@ -3853,8 +3838,8 @@ packages: resolution: {integrity: sha512-YgvUTfwqyc7UXVMrB+SImsVYSmTS8X/tSrtdNZMImM+n7+QTriRXyXim0mBrTXNeqzVF0KWGgHPeiyViFFrNDw==} engines: {node: '>=18'} - yaml@2.8.3: - resolution: {integrity: sha512-AvbaCLOO2Otw/lW5bmh9d/WEdcDFdQp2Z2ZUH3pX9U2ihyUY0nvLv7J6TrWowklRGPYbB/IuIMfYgxaCPg5Bpg==} + yaml@2.8.4: + resolution: {integrity: sha512-ml/JPOj9fOQK8RNnWojA67GbZ0ApXAUlN2UQclwv2eVgTgn7O9gg9o7paZWKMp4g0H3nTLtS9LVzhkpOFIKzog==} engines: {node: '>= 14.6'} hasBin: true @@ -3938,7 +3923,7 @@ snapshots: '@babel/helper-validator-identifier@7.28.5': {} - '@babel/parser@7.29.2': + '@babel/parser@7.29.3': dependencies: '@babel/types': 7.29.0 @@ -3956,11 +3941,11 @@ snapshots: '@colors/colors@1.5.0': optional: true - '@commitlint/cli@20.5.2(@types/node@24.12.2)(conventional-commits-filter@5.0.0)(conventional-commits-parser@6.4.0)(typescript@6.0.3)': + '@commitlint/cli@20.5.3(@types/node@24.12.2)(conventional-commits-filter@5.0.0)(conventional-commits-parser@6.4.0)(typescript@6.0.3)': dependencies: '@commitlint/format': 20.5.0 - '@commitlint/lint': 20.5.0 - '@commitlint/load': 20.5.2(@types/node@24.12.2)(typescript@6.0.3) + '@commitlint/lint': 20.5.3 + '@commitlint/load': 20.5.3(@types/node@24.12.2)(typescript@6.0.3) '@commitlint/read': 20.5.0(conventional-commits-filter@5.0.0)(conventional-commits-parser@6.4.0) '@commitlint/types': 20.5.0 tinyexec: 1.1.2 @@ -3971,7 +3956,7 @@ snapshots: - conventional-commits-parser - typescript - '@commitlint/config-conventional@20.5.0': + '@commitlint/config-conventional@20.5.3': dependencies: '@commitlint/types': 20.5.0 conventional-changelog-conventionalcommits: 9.3.1 @@ -3981,14 +3966,10 @@ snapshots: '@commitlint/types': 20.5.0 ajv: 8.20.0 - '@commitlint/ensure@20.5.0': + '@commitlint/ensure@20.5.3': dependencies: '@commitlint/types': 20.5.0 - lodash.camelcase: 4.3.0 - lodash.kebabcase: 4.1.1 - lodash.snakecase: 4.1.1 - lodash.startcase: 4.4.0 - lodash.upperfirst: 4.3.1 + es-toolkit: 1.46.1 '@commitlint/execute-rule@20.0.0': {} @@ -4002,23 +3983,23 @@ snapshots: '@commitlint/types': 20.5.0 semver: 7.7.4 - '@commitlint/lint@20.5.0': + '@commitlint/lint@20.5.3': dependencies: '@commitlint/is-ignored': 20.5.0 '@commitlint/parse': 20.5.0 - '@commitlint/rules': 20.5.0 + '@commitlint/rules': 20.5.3 '@commitlint/types': 20.5.0 - '@commitlint/load@20.5.2(@types/node@24.12.2)(typescript@6.0.3)': + '@commitlint/load@20.5.3(@types/node@24.12.2)(typescript@6.0.3)': dependencies: '@commitlint/config-validator': 20.5.0 '@commitlint/execute-rule': 20.0.0 - '@commitlint/resolve-extends': 20.5.2 + '@commitlint/resolve-extends': 20.5.3 '@commitlint/types': 20.5.0 cosmiconfig: 9.0.1(typescript@6.0.3) cosmiconfig-typescript-loader: 6.3.0(@types/node@24.12.2)(cosmiconfig@9.0.1(typescript@6.0.3))(typescript@6.0.3) + es-toolkit: 1.46.1 is-plain-obj: 4.1.0 - lodash.mergewith: 4.6.2 picocolors: 1.1.1 transitivePeerDependencies: - '@types/node' @@ -4043,18 +4024,18 @@ snapshots: - conventional-commits-filter - conventional-commits-parser - '@commitlint/resolve-extends@20.5.2': + '@commitlint/resolve-extends@20.5.3': dependencies: '@commitlint/config-validator': 20.5.0 '@commitlint/types': 20.5.0 + es-toolkit: 1.46.1 global-directory: 5.0.0 import-meta-resolve: 4.2.0 - lodash.mergewith: 4.6.2 resolve-from: 5.0.0 - '@commitlint/rules@20.5.0': + '@commitlint/rules@20.5.3': dependencies: - '@commitlint/ensure': 20.5.0 + '@commitlint/ensure': 20.5.3 '@commitlint/message': 20.4.3 '@commitlint/to-lines': 20.0.0 '@commitlint/types': 20.5.0 @@ -4448,7 +4429,7 @@ snapshots: bin-links: 6.0.0 cacache: 20.0.4 common-ancestor-path: 2.0.0 - hosted-git-info: 9.0.2 + hosted-git-info: 9.0.3 json-stringify-nice: 1.1.4 lru-cache: 11.3.5 minimatch: 10.2.5 @@ -4515,7 +4496,7 @@ snapshots: dependencies: '@npmcli/git': 7.0.2 glob: 13.0.6 - hosted-git-info: 9.0.2 + hosted-git-info: 9.0.3 json-parse-even-better-errors: 5.0.0 proc-log: 6.1.0 semver: 7.7.4 @@ -4696,7 +4677,7 @@ snapshots: dir-glob: 3.0.1 http-proxy-agent: 7.0.2 https-proxy-agent: 7.0.6 - issue-parser: 7.0.1 + issue-parser: 7.0.2 lodash-es: 4.18.1 mime: 4.1.0 p-filter: 4.1.0 @@ -4906,36 +4887,36 @@ snapshots: '@typescript-eslint/types': 8.59.1 eslint-visitor-keys: 5.0.1 - '@typescript/native-preview-darwin-arm64@7.0.0-dev.20260429.1': + '@typescript/native-preview-darwin-arm64@7.0.0-dev.20260502.1': optional: true - '@typescript/native-preview-darwin-x64@7.0.0-dev.20260429.1': + '@typescript/native-preview-darwin-x64@7.0.0-dev.20260502.1': optional: true - '@typescript/native-preview-linux-arm64@7.0.0-dev.20260429.1': + '@typescript/native-preview-linux-arm64@7.0.0-dev.20260502.1': optional: true - '@typescript/native-preview-linux-arm@7.0.0-dev.20260429.1': + '@typescript/native-preview-linux-arm@7.0.0-dev.20260502.1': optional: true - '@typescript/native-preview-linux-x64@7.0.0-dev.20260429.1': + '@typescript/native-preview-linux-x64@7.0.0-dev.20260502.1': optional: true - '@typescript/native-preview-win32-arm64@7.0.0-dev.20260429.1': + '@typescript/native-preview-win32-arm64@7.0.0-dev.20260502.1': optional: true - '@typescript/native-preview-win32-x64@7.0.0-dev.20260429.1': + '@typescript/native-preview-win32-x64@7.0.0-dev.20260502.1': optional: true - '@typescript/native-preview@7.0.0-dev.20260429.1': + '@typescript/native-preview@7.0.0-dev.20260502.1': optionalDependencies: - '@typescript/native-preview-darwin-arm64': 7.0.0-dev.20260429.1 - '@typescript/native-preview-darwin-x64': 7.0.0-dev.20260429.1 - '@typescript/native-preview-linux-arm': 7.0.0-dev.20260429.1 - '@typescript/native-preview-linux-arm64': 7.0.0-dev.20260429.1 - '@typescript/native-preview-linux-x64': 7.0.0-dev.20260429.1 - '@typescript/native-preview-win32-arm64': 7.0.0-dev.20260429.1 - '@typescript/native-preview-win32-x64': 7.0.0-dev.20260429.1 + '@typescript/native-preview-darwin-arm64': 7.0.0-dev.20260502.1 + '@typescript/native-preview-darwin-x64': 7.0.0-dev.20260502.1 + '@typescript/native-preview-linux-arm': 7.0.0-dev.20260502.1 + '@typescript/native-preview-linux-arm64': 7.0.0-dev.20260502.1 + '@typescript/native-preview-linux-x64': 7.0.0-dev.20260502.1 + '@typescript/native-preview-win32-arm64': 7.0.0-dev.20260502.1 + '@typescript/native-preview-win32-x64': 7.0.0-dev.20260502.1 '@ungap/structured-clone@1.3.0': {} @@ -5010,7 +4991,7 @@ snapshots: obug: 2.1.1 std-env: 4.1.0 tinyrainbow: 3.1.0 - vitest: 4.1.5(@types/node@24.12.2)(@vitest/coverage-v8@4.1.5)(jsdom@29.1.0)(vite@8.0.10(@types/node@24.12.2)(jiti@2.6.1)(yaml@2.8.3)) + vitest: 4.1.5(@types/node@24.12.2)(@vitest/coverage-v8@4.1.5)(jsdom@29.1.1)(vite@8.0.10(@types/node@24.12.2)(jiti@2.6.1)(yaml@2.8.4)) '@vitest/expect@4.1.5': dependencies: @@ -5021,13 +5002,13 @@ snapshots: chai: 6.2.2 tinyrainbow: 3.1.0 - '@vitest/mocker@4.1.5(vite@8.0.10(@types/node@24.12.2)(jiti@2.6.1)(yaml@2.8.3))': + '@vitest/mocker@4.1.5(vite@8.0.10(@types/node@24.12.2)(jiti@2.6.1)(yaml@2.8.4))': dependencies: '@vitest/spy': 4.1.5 estree-walker: 3.0.3 magic-string: 0.30.21 optionalDependencies: - vite: 8.0.10(@types/node@24.12.2)(jiti@2.6.1)(yaml@2.8.3) + vite: 8.0.10(@types/node@24.12.2)(jiti@2.6.1)(yaml@2.8.4) '@vitest/pretty-format@4.1.5': dependencies: @@ -5351,15 +5332,15 @@ snapshots: array-timsort: 1.0.3 esprima: 4.0.1 - commitlint-plugin-cspell@0.8.0(@commitlint/lint@20.5.0): + commitlint-plugin-cspell@0.8.0(@commitlint/lint@20.5.3): dependencies: - '@commitlint/lint': 20.5.0 + '@commitlint/lint': 20.5.3 '@commitlint/types': 20.5.0 cspell-lib: 10.0.0 - commitlint@20.5.2(@types/node@24.12.2)(conventional-commits-filter@5.0.0)(conventional-commits-parser@6.4.0)(typescript@6.0.3): + commitlint@20.5.3(@types/node@24.12.2)(conventional-commits-filter@5.0.0)(conventional-commits-parser@6.4.0)(typescript@6.0.3): dependencies: - '@commitlint/cli': 20.5.2(@types/node@24.12.2)(conventional-commits-filter@5.0.0)(conventional-commits-parser@6.4.0)(typescript@6.0.3) + '@commitlint/cli': 20.5.3(@types/node@24.12.2)(conventional-commits-filter@5.0.0)(conventional-commits-parser@6.4.0)(typescript@6.0.3) '@commitlint/types': 20.5.0 transitivePeerDependencies: - '@types/node' @@ -5441,7 +5422,7 @@ snapshots: '@cspell/cspell-types': 10.0.0 comment-json: 4.6.2 smol-toml: 1.6.1 - yaml: 2.8.3 + yaml: 2.8.4 cspell-dictionary@10.0.0: dependencies: @@ -5721,6 +5702,8 @@ snapshots: is-date-object: 1.1.0 is-symbol: 1.1.1 + es-toolkit@1.46.1: {} + escalade@3.2.0: {} escape-string-regexp@1.0.5: {} @@ -6156,7 +6139,7 @@ snapshots: dependencies: lru-cache: 10.4.3 - hosted-git-info@9.0.2: + hosted-git-info@9.0.3: dependencies: lru-cache: 11.3.5 @@ -6247,7 +6230,7 @@ snapshots: from2: 2.3.0 p-is-promise: 3.0.0 - ip-address@10.1.1: {} + ip-address@10.2.0: {} is-array-buffer@3.0.5: dependencies: @@ -6393,7 +6376,7 @@ snapshots: isexe@4.0.0: {} - issue-parser@7.0.1: + issue-parser@7.0.2: dependencies: lodash.capitalize: 4.2.1 lodash.escaperegexp: 4.1.2 @@ -6426,7 +6409,7 @@ snapshots: dependencies: argparse: 2.0.1 - jsdom@29.1.0: + jsdom@29.1.1: dependencies: '@asamuzakjp/css-color': 5.1.11 '@asamuzakjp/dom-selector': 7.1.1 @@ -6553,7 +6536,7 @@ snapshots: picomatch: 4.0.4 string-argv: 0.3.2 tinyexec: 1.1.2 - yaml: 2.8.3 + yaml: 2.8.4 listr2@9.0.5: dependencies: @@ -6582,8 +6565,6 @@ snapshots: lodash-es@4.18.1: {} - lodash.camelcase@4.3.0: {} - lodash.capitalize@4.2.1: {} lodash.escaperegexp@4.1.2: {} @@ -6592,20 +6573,10 @@ snapshots: lodash.isstring@4.0.1: {} - lodash.kebabcase@4.1.1: {} - lodash.merge@4.6.2: {} - lodash.mergewith@4.6.2: {} - - lodash.snakecase@4.1.1: {} - - lodash.startcase@4.4.0: {} - lodash.uniqby@4.7.0: {} - lodash.upperfirst@4.3.1: {} - log-update@6.1.0: dependencies: ansi-escapes: 7.3.0 @@ -6624,7 +6595,7 @@ snapshots: magicast@0.5.2: dependencies: - '@babel/parser': 7.29.2 + '@babel/parser': 7.29.3 '@babel/types': 7.29.0 source-map-js: 1.2.1 @@ -6739,7 +6710,7 @@ snapshots: object-assign: 4.1.1 thenify-all: 1.6.0 - nanoid@3.3.11: {} + nanoid@3.3.12: {} napi-postinstall@0.3.4: {} @@ -6790,7 +6761,7 @@ snapshots: normalize-package-data@8.0.0: dependencies: - hosted-git-info: 9.0.2 + hosted-git-info: 9.0.3 semver: 7.7.4 validate-npm-package-license: 3.0.4 @@ -6808,7 +6779,7 @@ snapshots: npm-package-arg@13.0.2: dependencies: - hosted-git-info: 9.0.2 + hosted-git-info: 9.0.3 proc-log: 6.1.0 semver: 7.7.4 validate-npm-package-name: 7.0.2 @@ -7063,9 +7034,9 @@ snapshots: cssesc: 3.0.0 util-deprecate: 1.0.2 - postcss@8.5.12: + postcss@8.5.13: dependencies: - nanoid: 3.3.11 + nanoid: 3.3.12 picocolors: 1.1.1 source-map-js: 1.2.1 @@ -7271,7 +7242,7 @@ snapshots: get-stream: 6.0.1 git-log-parser: 1.2.1 hook-std: 4.0.0 - hosted-git-info: 9.0.2 + hosted-git-info: 9.0.3 import-from-esm: 2.0.0 lodash-es: 4.18.1 marked: 15.0.12 @@ -7399,7 +7370,7 @@ snapshots: socks@2.8.8: dependencies: - ip-address: 10.1.1 + ip-address: 10.2.0 smart-buffer: 4.2.0 source-map-js@1.2.1: {} @@ -7587,11 +7558,11 @@ snapshots: tinyrainbow@3.1.0: {} - tldts-core@7.0.29: {} + tldts-core@7.0.30: {} - tldts@7.0.29: + tldts@7.0.30: dependencies: - tldts-core: 7.0.29 + tldts-core: 7.0.30 to-regex-range@5.0.1: dependencies: @@ -7599,7 +7570,7 @@ snapshots: tough-cookie@6.0.1: dependencies: - tldts: 7.0.29 + tldts: 7.0.30 tr46@6.0.0: dependencies: @@ -7763,23 +7734,23 @@ snapshots: transitivePeerDependencies: - supports-color - vite@8.0.10(@types/node@24.12.2)(jiti@2.6.1)(yaml@2.8.3): + vite@8.0.10(@types/node@24.12.2)(jiti@2.6.1)(yaml@2.8.4): dependencies: lightningcss: 1.32.0 picomatch: 4.0.4 - postcss: 8.5.12 + postcss: 8.5.13 rolldown: 1.0.0-rc.17 tinyglobby: 0.2.16 optionalDependencies: '@types/node': 24.12.2 fsevents: 2.3.3 jiti: 2.6.1 - yaml: 2.8.3 + yaml: 2.8.4 - vitest@4.1.5(@types/node@24.12.2)(@vitest/coverage-v8@4.1.5)(jsdom@29.1.0)(vite@8.0.10(@types/node@24.12.2)(jiti@2.6.1)(yaml@2.8.3)): + vitest@4.1.5(@types/node@24.12.2)(@vitest/coverage-v8@4.1.5)(jsdom@29.1.1)(vite@8.0.10(@types/node@24.12.2)(jiti@2.6.1)(yaml@2.8.4)): dependencies: '@vitest/expect': 4.1.5 - '@vitest/mocker': 4.1.5(vite@8.0.10(@types/node@24.12.2)(jiti@2.6.1)(yaml@2.8.3)) + '@vitest/mocker': 4.1.5(vite@8.0.10(@types/node@24.12.2)(jiti@2.6.1)(yaml@2.8.4)) '@vitest/pretty-format': 4.1.5 '@vitest/runner': 4.1.5 '@vitest/snapshot': 4.1.5 @@ -7796,12 +7767,12 @@ snapshots: tinyexec: 1.1.2 tinyglobby: 0.2.16 tinyrainbow: 3.1.0 - vite: 8.0.10(@types/node@24.12.2)(jiti@2.6.1)(yaml@2.8.3) + vite: 8.0.10(@types/node@24.12.2)(jiti@2.6.1)(yaml@2.8.4) why-is-node-running: 2.3.0 optionalDependencies: '@types/node': 24.12.2 '@vitest/coverage-v8': 4.1.5(vitest@4.1.5) - jsdom: 29.1.0 + jsdom: 29.1.1 transitivePeerDependencies: - msw @@ -7919,7 +7890,7 @@ snapshots: yallist@5.0.0: {} - yaml@2.8.3: {} + yaml@2.8.4: {} yargs-parser@20.2.9: {} diff --git a/src/countCharCode.ts b/src/countCharCode.ts new file mode 100644 index 0000000..04ea186 --- /dev/null +++ b/src/countCharCode.ts @@ -0,0 +1,11 @@ +export function countCharCode(input: string, charCode: number): number { + let count = 0; + + for (let index = 0, length = input.length; index < length; ++index) { + if (input.charCodeAt(index) === charCode) { + ++count; + } + } + + return count; +} diff --git a/src/countCharacter.ts b/src/countCharacter.ts new file mode 100644 index 0000000..098cd52 --- /dev/null +++ b/src/countCharacter.ts @@ -0,0 +1,9 @@ +import { countCharCode } from './countCharCode.js'; + +export function countCharacter(input: string, char: string): number { + if (char.length !== 1) { + throw new Error('Expected a single character'); + } + + return countCharCode(input, char.charCodeAt(0)); +} diff --git a/src/index.ts b/src/index.ts index 1105ef6..636a2c1 100644 --- a/src/index.ts +++ b/src/index.ts @@ -15,6 +15,8 @@ export * from './combinations.js'; export * from './comment.js'; export * from './compose.js'; export * from './convert.js'; +export * from './countCharacter.js'; +export * from './countCharCode.js'; export * from './counter.js'; export * from './deepDecodeURI.js'; export * from './deepFreeze.js'; diff --git a/test/countCharCode.test.ts b/test/countCharCode.test.ts new file mode 100644 index 0000000..4050758 --- /dev/null +++ b/test/countCharCode.test.ts @@ -0,0 +1,11 @@ +import { describe, expect, it } from 'vitest'; + +import { countCharCode } from '../src/countCharCode.js'; + +describe('countCharCode()', () => { + it('should count the number of occurrences of a specific character code', () => { + expect(countCharCode('Hello, World!', 108)).toBe(3); + + expect(countCharCode('How are you today?', 42)).toBe(0); + }); +}); diff --git a/test/countCharacter.test.ts b/test/countCharacter.test.ts new file mode 100644 index 0000000..2c55d2a --- /dev/null +++ b/test/countCharacter.test.ts @@ -0,0 +1,16 @@ +import { describe, expect, it } from 'vitest'; + +import { countCharacter } from '../src/countCharacter.js'; + +describe('countCharacter()', () => { + it('should count the number of occurrences of a specific character', () => { + expect(countCharacter('Hello, World!', 'l')).toBe(3); + + expect(countCharacter('How are you today?', '*')).toBe(0); + }); + + it('should throw if the input is not a single character', () => { + expect(() => countCharacter('Hello, World!', 'll')).toThrow(); + expect(() => countCharacter('Some string', '')).toThrow(); + }); +});