nhb-toolbox 4.1.2 → 4.1.3
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/cjs/array/transform.js +1 -1
- package/dist/cjs/string/anagram.js +1 -1
- package/dist/cjs/string/convert.js +4 -4
- package/dist/dts/array/types.d.ts.map +1 -1
- package/dist/dts/string/anagram.d.ts +1 -1
- package/dist/dts/string/convert.d.ts +4 -4
- package/dist/esm/array/transform.js +1 -1
- package/dist/esm/string/anagram.js +1 -1
- package/dist/esm/string/convert.js +4 -4
- package/package.json +1 -1
|
@@ -77,7 +77,7 @@ function getDuplicates(array) {
|
|
|
77
77
|
function findMissingElements(array1, array2, missingFrom) {
|
|
78
78
|
const source = missingFrom === 'from-first' ? array1 : array2;
|
|
79
79
|
const target = missingFrom === 'from-first' ? array2 : array1;
|
|
80
|
-
return source.filter((
|
|
80
|
+
return source.filter((s) => !target.some((t) => (0, utils_1.isDeepEqual)(t, s)));
|
|
81
81
|
}
|
|
82
82
|
/**
|
|
83
83
|
* * Splits an array into chunks of a given size.
|
|
@@ -5,7 +5,7 @@ exports.generateAnagrams = generateAnagrams;
|
|
|
5
5
|
* * Utility to generate unique anagrams of a word.
|
|
6
6
|
* @param word The word for generating anagrams.
|
|
7
7
|
* @param limit The maximum number of anagrams to return ('all' for unlimited). Default is `100`.
|
|
8
|
-
* @returns An array of generated anagrams. The first element is always the given word. Generated
|
|
8
|
+
* @returns An array of generated anagrams. The first element is always the given word. Generated anagrams are always in lowercase.
|
|
9
9
|
*/
|
|
10
10
|
function generateAnagrams(word, limit = 100) {
|
|
11
11
|
if (word.length <= 1) {
|
|
@@ -9,10 +9,10 @@ exports.formatUnitWithPlural = formatUnitWithPlural;
|
|
|
9
9
|
const basics_1 = require("./basics");
|
|
10
10
|
const constants_1 = require("./constants");
|
|
11
11
|
/**
|
|
12
|
-
* Converts a string to a specified case format such as `camelCase`, `snake_case`, `kebab-case`, `PascalCase`, `Title Case`, `lowercase`, or `UPPERCASE`.
|
|
12
|
+
* * Converts a string to a specified case format such as `camelCase`, `snake_case`, `kebab-case`, `PascalCase`, `Title Case`, `lowercase`, or `UPPERCASE`.
|
|
13
13
|
*
|
|
14
|
-
* This function handles non-alphanumeric characters (e.g., spaces, hyphens, underscores, dots, slashes) as word delimiters. For `Title Case`, prepositions, articles, conjunctions, and auxiliary verbs are not capitalized unless they appear at the start of the title.
|
|
15
|
-
* You can also convert the string to `lowercase` or `UPPERCASE`, but it's recommended to use default string methods like `string.toLowerCase()` and `string.toUpperCase()` for these cases.
|
|
14
|
+
* - This function handles non-alphanumeric characters (e.g., spaces, hyphens, underscores, dots, slashes) as word delimiters. For `Title Case`, prepositions, articles, conjunctions, and auxiliary verbs are not capitalized unless they appear at the start of the title.
|
|
15
|
+
* - You can also convert the string to `lowercase` or `UPPERCASE`, but it's recommended to use default string methods like `string.toLowerCase()` and `string.toUpperCase()` for these cases.
|
|
16
16
|
*
|
|
17
17
|
* @param string The input string to be converted. The string should have words separated by non-alphanumeric characters (e.g., spaces, hyphens, underscores, etc.).
|
|
18
18
|
* @param format The format to convert the string to. The available formats are:
|
|
@@ -92,7 +92,7 @@ function convertStringCase(string, format) {
|
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
94
|
/**
|
|
95
|
-
* Replaces all occurrences of a string or pattern in the given input string.
|
|
95
|
+
* * Replaces all occurrences of a string or pattern in the given input string.
|
|
96
96
|
*
|
|
97
97
|
* - If `find` is a string, it is converted into a global regular expression (`/find/g`).
|
|
98
98
|
* - If `find` is a `RegExp`, the global (`g`) flag is ensured.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/array/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACzE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAE7C,uCAAuC;AACv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AW,CAAC,EAAE,OAAO,CAAC;IACtB,kEAAkE;IAClE,IAAI,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;CACzB"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* * Utility to generate unique anagrams of a word.
|
|
3
3
|
* @param word The word for generating anagrams.
|
|
4
4
|
* @param limit The maximum number of anagrams to return ('all' for unlimited). Default is `100`.
|
|
5
|
-
* @returns An array of generated anagrams. The first element is always the given word. Generated
|
|
5
|
+
* @returns An array of generated anagrams. The first element is always the given word. Generated anagrams are always in lowercase.
|
|
6
6
|
*/
|
|
7
7
|
export declare function generateAnagrams(word: string, limit?: number | 'all'): Lowercase<string>[];
|
|
8
8
|
//# sourceMappingURL=anagram.d.ts.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { CaseFormat, MaskOptions } from './types';
|
|
2
2
|
/**
|
|
3
|
-
* Converts a string to a specified case format such as `camelCase`, `snake_case`, `kebab-case`, `PascalCase`, `Title Case`, `lowercase`, or `UPPERCASE`.
|
|
3
|
+
* * Converts a string to a specified case format such as `camelCase`, `snake_case`, `kebab-case`, `PascalCase`, `Title Case`, `lowercase`, or `UPPERCASE`.
|
|
4
4
|
*
|
|
5
|
-
* This function handles non-alphanumeric characters (e.g., spaces, hyphens, underscores, dots, slashes) as word delimiters. For `Title Case`, prepositions, articles, conjunctions, and auxiliary verbs are not capitalized unless they appear at the start of the title.
|
|
6
|
-
* You can also convert the string to `lowercase` or `UPPERCASE`, but it's recommended to use default string methods like `string.toLowerCase()` and `string.toUpperCase()` for these cases.
|
|
5
|
+
* - This function handles non-alphanumeric characters (e.g., spaces, hyphens, underscores, dots, slashes) as word delimiters. For `Title Case`, prepositions, articles, conjunctions, and auxiliary verbs are not capitalized unless they appear at the start of the title.
|
|
6
|
+
* - You can also convert the string to `lowercase` or `UPPERCASE`, but it's recommended to use default string methods like `string.toLowerCase()` and `string.toUpperCase()` for these cases.
|
|
7
7
|
*
|
|
8
8
|
* @param string The input string to be converted. The string should have words separated by non-alphanumeric characters (e.g., spaces, hyphens, underscores, etc.).
|
|
9
9
|
* @param format The format to convert the string to. The available formats are:
|
|
@@ -25,7 +25,7 @@ import type { CaseFormat, MaskOptions } from './types';
|
|
|
25
25
|
*/
|
|
26
26
|
export declare function convertStringCase(string: string, format: CaseFormat): string;
|
|
27
27
|
/**
|
|
28
|
-
* Replaces all occurrences of a string or pattern in the given input string.
|
|
28
|
+
* * Replaces all occurrences of a string or pattern in the given input string.
|
|
29
29
|
*
|
|
30
30
|
* - If `find` is a string, it is converted into a global regular expression (`/find/g`).
|
|
31
31
|
* - If `find` is a `RegExp`, the global (`g`) flag is ensured.
|
|
@@ -67,7 +67,7 @@ export function getDuplicates(array) {
|
|
|
67
67
|
export function findMissingElements(array1, array2, missingFrom) {
|
|
68
68
|
const source = missingFrom === 'from-first' ? array1 : array2;
|
|
69
69
|
const target = missingFrom === 'from-first' ? array2 : array1;
|
|
70
|
-
return source.filter((
|
|
70
|
+
return source.filter((s) => !target.some((t) => isDeepEqual(t, s)));
|
|
71
71
|
}
|
|
72
72
|
/**
|
|
73
73
|
* * Splits an array into chunks of a given size.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* * Utility to generate unique anagrams of a word.
|
|
3
3
|
* @param word The word for generating anagrams.
|
|
4
4
|
* @param limit The maximum number of anagrams to return ('all' for unlimited). Default is `100`.
|
|
5
|
-
* @returns An array of generated anagrams. The first element is always the given word. Generated
|
|
5
|
+
* @returns An array of generated anagrams. The first element is always the given word. Generated anagrams are always in lowercase.
|
|
6
6
|
*/
|
|
7
7
|
export function generateAnagrams(word, limit = 100) {
|
|
8
8
|
if (word.length <= 1) {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { trimString } from './basics';
|
|
2
2
|
import { LOWERCASE } from './constants';
|
|
3
3
|
/**
|
|
4
|
-
* Converts a string to a specified case format such as `camelCase`, `snake_case`, `kebab-case`, `PascalCase`, `Title Case`, `lowercase`, or `UPPERCASE`.
|
|
4
|
+
* * Converts a string to a specified case format such as `camelCase`, `snake_case`, `kebab-case`, `PascalCase`, `Title Case`, `lowercase`, or `UPPERCASE`.
|
|
5
5
|
*
|
|
6
|
-
* This function handles non-alphanumeric characters (e.g., spaces, hyphens, underscores, dots, slashes) as word delimiters. For `Title Case`, prepositions, articles, conjunctions, and auxiliary verbs are not capitalized unless they appear at the start of the title.
|
|
7
|
-
* You can also convert the string to `lowercase` or `UPPERCASE`, but it's recommended to use default string methods like `string.toLowerCase()` and `string.toUpperCase()` for these cases.
|
|
6
|
+
* - This function handles non-alphanumeric characters (e.g., spaces, hyphens, underscores, dots, slashes) as word delimiters. For `Title Case`, prepositions, articles, conjunctions, and auxiliary verbs are not capitalized unless they appear at the start of the title.
|
|
7
|
+
* - You can also convert the string to `lowercase` or `UPPERCASE`, but it's recommended to use default string methods like `string.toLowerCase()` and `string.toUpperCase()` for these cases.
|
|
8
8
|
*
|
|
9
9
|
* @param string The input string to be converted. The string should have words separated by non-alphanumeric characters (e.g., spaces, hyphens, underscores, etc.).
|
|
10
10
|
* @param format The format to convert the string to. The available formats are:
|
|
@@ -84,7 +84,7 @@ export function convertStringCase(string, format) {
|
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
86
|
/**
|
|
87
|
-
* Replaces all occurrences of a string or pattern in the given input string.
|
|
87
|
+
* * Replaces all occurrences of a string or pattern in the given input string.
|
|
88
88
|
*
|
|
89
89
|
* - If `find` is a string, it is converted into a global regular expression (`/find/g`).
|
|
90
90
|
* - If `find` is a `RegExp`, the global (`g`) flag is ensured.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nhb-toolbox",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.3",
|
|
4
4
|
"description": "A versatile collection of smart, efficient, and reusable utility functions and classes for everyday development needs.",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|