@thainanluiz/tssuper 0.0.3 → 0.0.4

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.
package/dist/index.d.mts CHANGED
@@ -3,6 +3,17 @@ type RandomIntProps = {
3
3
  max: number;
4
4
  };
5
5
 
6
+ /**
7
+ * Generate a random integer between min and max (inclusive)
8
+ * @param {RandomIntProps} { min, max }
9
+ * @returns {number}
10
+ */
6
11
  declare function randomInt({ min, max }: RandomIntProps): number;
7
12
 
8
- export { type RandomIntProps, randomInt };
13
+ type index_RandomIntProps = RandomIntProps;
14
+ declare const index_randomInt: typeof randomInt;
15
+ declare namespace index {
16
+ export { type index_RandomIntProps as RandomIntProps, index_randomInt as randomInt };
17
+ }
18
+
19
+ export { index as math };
package/dist/index.d.ts CHANGED
@@ -3,6 +3,17 @@ type RandomIntProps = {
3
3
  max: number;
4
4
  };
5
5
 
6
+ /**
7
+ * Generate a random integer between min and max (inclusive)
8
+ * @param {RandomIntProps} { min, max }
9
+ * @returns {number}
10
+ */
6
11
  declare function randomInt({ min, max }: RandomIntProps): number;
7
12
 
8
- export { type RandomIntProps, randomInt };
13
+ type index_RandomIntProps = RandomIntProps;
14
+ declare const index_randomInt: typeof randomInt;
15
+ declare namespace index {
16
+ export { type index_RandomIntProps as RandomIntProps, index_randomInt as randomInt };
17
+ }
18
+
19
+ export { index as math };
package/dist/index.js CHANGED
@@ -20,15 +20,30 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/index.ts
21
21
  var src_exports = {};
22
22
  __export(src_exports, {
23
- randomInt: () => randomInt
23
+ math: () => math_exports
24
24
  });
25
25
  module.exports = __toCommonJS(src_exports);
26
26
 
27
- // src/functions/randomInt.ts
27
+ // src/math/index.ts
28
+ var math_exports = {};
29
+ __export(math_exports, {
30
+ randomInt: () => randomInt
31
+ });
32
+
33
+ // src/math/functions/randomInt.ts
28
34
  function randomInt({ min, max }) {
35
+ if (typeof min !== "number" || typeof max !== "number") {
36
+ throw new Error("min and max must be numbers");
37
+ }
38
+ if (!Number.isInteger(min) || !Number.isInteger(max)) {
39
+ throw new Error("min and max must be integers");
40
+ }
41
+ if (min > max) {
42
+ throw new Error("min must be less than or equal to max");
43
+ }
29
44
  return Math.floor(Math.random() * (max - min + 1)) + min;
30
45
  }
31
46
  // Annotate the CommonJS export names for ESM import in node:
32
47
  0 && (module.exports = {
33
- randomInt
48
+ math
34
49
  });
package/dist/index.mjs CHANGED
@@ -1,7 +1,28 @@
1
- // src/functions/randomInt.ts
1
+ var __defProp = Object.defineProperty;
2
+ var __export = (target, all) => {
3
+ for (var name in all)
4
+ __defProp(target, name, { get: all[name], enumerable: true });
5
+ };
6
+
7
+ // src/math/index.ts
8
+ var math_exports = {};
9
+ __export(math_exports, {
10
+ randomInt: () => randomInt
11
+ });
12
+
13
+ // src/math/functions/randomInt.ts
2
14
  function randomInt({ min, max }) {
15
+ if (typeof min !== "number" || typeof max !== "number") {
16
+ throw new Error("min and max must be numbers");
17
+ }
18
+ if (!Number.isInteger(min) || !Number.isInteger(max)) {
19
+ throw new Error("min and max must be integers");
20
+ }
21
+ if (min > max) {
22
+ throw new Error("min must be less than or equal to max");
23
+ }
3
24
  return Math.floor(Math.random() * (max - min + 1)) + min;
4
25
  }
5
26
  export {
6
- randomInt
27
+ math_exports as math
7
28
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thainanluiz/tssuper",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
4
4
  "description": "Simple add-on for TypeScript",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",