@webdeveric/utils 0.78.0 → 0.79.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.countCharCode = countCharCode;
4
+ function countCharCode(input, charCode) {
5
+ let count = 0;
6
+ for (let index = 0, length = input.length; index < length; ++index) {
7
+ if (input.charCodeAt(index) === charCode) {
8
+ ++count;
9
+ }
10
+ }
11
+ return count;
12
+ }
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.countCharacter = countCharacter;
4
+ const countCharCode_js_1 = require("./countCharCode.js");
5
+ function countCharacter(input, char) {
6
+ if (char.length !== 1) {
7
+ throw new Error('Expected a single character');
8
+ }
9
+ return (0, countCharCode_js_1.countCharCode)(input, char.charCodeAt(0));
10
+ }
package/dist/cjs/index.js CHANGED
@@ -28,6 +28,8 @@ __exportStar(require("./combinations.js"), exports);
28
28
  __exportStar(require("./comment.js"), exports);
29
29
  __exportStar(require("./compose.js"), exports);
30
30
  __exportStar(require("./convert.js"), exports);
31
+ __exportStar(require("./countCharacter.js"), exports);
32
+ __exportStar(require("./countCharCode.js"), exports);
31
33
  __exportStar(require("./counter.js"), exports);
32
34
  __exportStar(require("./deepDecodeURI.js"), exports);
33
35
  __exportStar(require("./deepFreeze.js"), exports);
@@ -0,0 +1,9 @@
1
+ export function countCharCode(input, charCode) {
2
+ let count = 0;
3
+ for (let index = 0, length = input.length; index < length; ++index) {
4
+ if (input.charCodeAt(index) === charCode) {
5
+ ++count;
6
+ }
7
+ }
8
+ return count;
9
+ }
@@ -0,0 +1,7 @@
1
+ import { countCharCode } from './countCharCode.js';
2
+ export function countCharacter(input, char) {
3
+ if (char.length !== 1) {
4
+ throw new Error('Expected a single character');
5
+ }
6
+ return countCharCode(input, char.charCodeAt(0));
7
+ }
package/dist/mjs/index.js CHANGED
@@ -12,6 +12,8 @@ export * from './combinations.js';
12
12
  export * from './comment.js';
13
13
  export * from './compose.js';
14
14
  export * from './convert.js';
15
+ export * from './countCharacter.js';
16
+ export * from './countCharCode.js';
15
17
  export * from './counter.js';
16
18
  export * from './deepDecodeURI.js';
17
19
  export * from './deepFreeze.js';
@@ -0,0 +1 @@
1
+ export declare function countCharCode(input: string, charCode: number): number;
@@ -0,0 +1 @@
1
+ export declare function countCharacter(input: string, char: string): number;
@@ -12,6 +12,8 @@ export * from './combinations.js';
12
12
  export * from './comment.js';
13
13
  export * from './compose.js';
14
14
  export * from './convert.js';
15
+ export * from './countCharacter.js';
16
+ export * from './countCharCode.js';
15
17
  export * from './counter.js';
16
18
  export * from './deepDecodeURI.js';
17
19
  export * from './deepFreeze.js';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@webdeveric/utils",
3
3
  "description": "Just another collection of utilities.",
4
- "version": "0.78.0",
4
+ "version": "0.79.0",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -85,14 +85,14 @@
85
85
  },
86
86
  "prettier": "@webdeveric/prettier-config",
87
87
  "devDependencies": {
88
- "@commitlint/config-conventional": "^20.5.0",
88
+ "@commitlint/config-conventional": "^20.5.3",
89
89
  "@commitlint/types": "^20.5.0",
90
90
  "@types/node": "^24.12.2",
91
- "@typescript/native-preview": "7.0.0-dev.20260423.1",
91
+ "@typescript/native-preview": "7.0.0-dev.20260502.1",
92
92
  "@vitest/coverage-v8": "^4.1.5",
93
93
  "@webdeveric/eslint-config-ts": "^0.12.0",
94
94
  "@webdeveric/prettier-config": "^0.4.0",
95
- "commitlint": "^20.5.0",
95
+ "commitlint": "^20.5.3",
96
96
  "commitlint-plugin-cspell": "^0.8.0",
97
97
  "conventional-changelog-conventionalcommits": "^9.3.1",
98
98
  "cspell": "^10.0.0",
@@ -101,12 +101,12 @@
101
101
  "eslint-import-resolver-typescript": "^4.4.4",
102
102
  "eslint-plugin-import": "^2.32.0",
103
103
  "husky": "^9.1.7",
104
- "jsdom": "^29.0.2",
104
+ "jsdom": "^29.1.1",
105
105
  "lint-staged": "^16.4.0",
106
106
  "prettier": "^3.8.3",
107
107
  "rimraf": "^6.1.3",
108
108
  "semantic-release": "^25.0.3",
109
- "validate-package-exports": "^0.23.0",
109
+ "validate-package-exports": "^0.24.0",
110
110
  "vitest": "^4.1.5"
111
111
  }
112
112
  }