nhb-toolbox 4.29.20 → 4.29.21
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/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,10 @@
|
|
|
4
4
|
|
|
5
5
|
All notable changes to the package will be documented here.
|
|
6
6
|
|
|
7
|
+
## [4.29.21] - 2026-04-05
|
|
8
|
+
|
|
9
|
+
- **Updated** tsdoc for `getNumbersInRange` utility to clarify the return type based on the `getAsString` flag.
|
|
10
|
+
|
|
7
11
|
## [4.29.20] - 2026-04-03
|
|
8
12
|
|
|
9
13
|
- **Updated** `isEven` and `isOdd` utilities to accept *numeric string* and return `false` for `NaN` and *non-integer* values.
|
package/dist/cjs/number/range.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getNumbersInRange = getNumbersInRange;
|
|
4
4
|
const basics_1 = require("../array/basics");
|
|
5
|
+
const primitives_1 = require("../guards/primitives");
|
|
5
6
|
const index_1 = require("../utils/index");
|
|
6
7
|
const basics_2 = require("./basics");
|
|
7
8
|
const guards_1 = require("./guards");
|
|
@@ -27,7 +28,7 @@ function getNumbersInRange(type = 'any', options) {
|
|
|
27
28
|
}
|
|
28
29
|
return numbers;
|
|
29
30
|
};
|
|
30
|
-
if (type === 'prime' &&
|
|
31
|
+
if (type === 'prime' && !(0, primitives_1.isUndefined)(multiplesOf)) {
|
|
31
32
|
console.warn('Warning: The "multiplesOf" option is ignored when the type is "prime"!');
|
|
32
33
|
}
|
|
33
34
|
switch (type) {
|
|
@@ -58,7 +59,5 @@ function getNumbersInRange(type = 'any', options) {
|
|
|
58
59
|
if (type !== 'prime') {
|
|
59
60
|
output = (0, helpers_1._applyMultiples)(output, multiplesOf);
|
|
60
61
|
}
|
|
61
|
-
return getAsString
|
|
62
|
-
? (0, index_1.convertArrayToString)(output, { separator })
|
|
63
|
-
: output;
|
|
62
|
+
return (getAsString ? (0, index_1.convertArrayToString)(output, { separator }) : output);
|
|
64
63
|
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { NumberType, RangedNumbers, RangeOptions } from './types';
|
|
2
2
|
/**
|
|
3
|
-
* * Function to get numbers within a range based on the provided
|
|
4
|
-
*
|
|
3
|
+
* * Function to get numbers within a range based on the provided {@link NumberType} and options.
|
|
4
|
+
*
|
|
5
|
+
* @remarks Returns either string or array of numbers based on the {@link RangeOptions.getAsString getAsString} option.
|
|
5
6
|
*
|
|
6
7
|
* @param type - The type of numbers to generate ('random', 'prime', etc.).
|
|
7
8
|
* @param options - Options to configure number generation, including range and formatting.
|
|
8
|
-
* @returns
|
|
9
|
+
* @returns The numbers in the range based on {@link type} and {@link options} either as string or array of numbers.
|
|
9
10
|
*/
|
|
10
11
|
export declare function getNumbersInRange<T extends boolean = false>(type?: NumberType, options?: RangeOptions<T>): RangedNumbers<T>;
|
package/dist/esm/number/range.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { shuffleArray } from '../array/basics.js';
|
|
2
|
+
import { isUndefined } from '../guards/primitives.js';
|
|
2
3
|
import { convertArrayToString } from '../utils/index.js';
|
|
3
4
|
import { getRandomNumber } from './basics.js';
|
|
4
5
|
import { isEven, isOdd } from './guards.js';
|
|
@@ -24,7 +25,7 @@ export function getNumbersInRange(type = 'any', options) {
|
|
|
24
25
|
}
|
|
25
26
|
return numbers;
|
|
26
27
|
};
|
|
27
|
-
if (type === 'prime' && multiplesOf
|
|
28
|
+
if (type === 'prime' && !isUndefined(multiplesOf)) {
|
|
28
29
|
console.warn('Warning: The "multiplesOf" option is ignored when the type is "prime"!');
|
|
29
30
|
}
|
|
30
31
|
switch (type) {
|
|
@@ -55,7 +56,5 @@ export function getNumbersInRange(type = 'any', options) {
|
|
|
55
56
|
if (type !== 'prime') {
|
|
56
57
|
output = _applyMultiples(output, multiplesOf);
|
|
57
58
|
}
|
|
58
|
-
return getAsString
|
|
59
|
-
? convertArrayToString(output, { separator })
|
|
60
|
-
: output;
|
|
59
|
+
return (getAsString ? convertArrayToString(output, { separator }) : output);
|
|
61
60
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nhb-toolbox",
|
|
3
|
-
"version": "4.29.
|
|
3
|
+
"version": "4.29.21",
|
|
4
4
|
"description": "A versatile collection of smart, efficient, and reusable utility functions, classes and types for everyday development needs.",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|