stringzy 4.0.0 → 4.1.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.
Files changed (71) hide show
  1. package/README.md +445 -34
  2. package/dist/analyzing/checkMultiplePatterns.d.ts +14 -0
  3. package/dist/analyzing/checkMultiplePatterns.js +63 -0
  4. package/dist/analyzing/checkSubsequence.d.ts +14 -0
  5. package/dist/analyzing/checkSubsequence.js +33 -0
  6. package/dist/analyzing/contentWordCount.d.ts +11 -0
  7. package/dist/analyzing/contentWordCount.js +23 -0
  8. package/dist/analyzing/functionWordCount.d.ts +11 -0
  9. package/dist/analyzing/functionWordCount.js +33 -0
  10. package/dist/analyzing/index.d.ts +11 -0
  11. package/dist/analyzing/index.js +18 -2
  12. package/dist/analyzing/patternCount.d.ts +6 -5
  13. package/dist/analyzing/patternCount.js +19 -17
  14. package/dist/analyzing/stringRotation.d.ts +29 -0
  15. package/dist/analyzing/stringRotation.js +44 -0
  16. package/dist/index.d.ts +13 -0
  17. package/dist/tests/analyzing/checkMultiplePatterns.test.d.ts +1 -0
  18. package/dist/tests/analyzing/checkMultiplePatterns.test.js +81 -0
  19. package/dist/tests/analyzing/checkSubsequence.test.d.ts +1 -0
  20. package/dist/tests/analyzing/checkSubsequence.test.js +34 -0
  21. package/dist/tests/analyzing/contentWordCount.test.d.ts +1 -0
  22. package/dist/tests/analyzing/contentWordCount.test.js +20 -0
  23. package/dist/tests/analyzing/functionWordCount.test.d.ts +1 -0
  24. package/dist/tests/analyzing/functionWordCount.test.js +20 -0
  25. package/dist/tests/analyzing/stringRotation.test.d.ts +1 -0
  26. package/dist/tests/analyzing/stringRotation.test.js +42 -0
  27. package/dist/tests/transformations/reverseString.test.d.ts +1 -0
  28. package/dist/tests/transformations/reverseString.test.js +41 -0
  29. package/dist/tests/transformations/stringCombinations.test.d.ts +1 -0
  30. package/dist/tests/transformations/stringCombinations.test.js +41 -0
  31. package/dist/tests/transformations/stringPermutations.test.d.ts +1 -0
  32. package/dist/tests/transformations/stringPermutations.test.js +40 -0
  33. package/dist/tests/validations/isAlphaNumeric.test.d.ts +1 -0
  34. package/dist/tests/validations/isAlphaNumeric.test.js +30 -0
  35. package/dist/tests/validations/isAlphabetic.test.d.ts +1 -0
  36. package/dist/tests/validations/isAlphabetic.test.js +32 -0
  37. package/dist/tests/validations/isAnagram.test.d.ts +1 -0
  38. package/dist/tests/validations/isAnagram.test.js +44 -0
  39. package/dist/tests/validations/isLowerCase.test.d.ts +1 -0
  40. package/dist/tests/validations/isLowerCase.test.js +50 -0
  41. package/dist/tests/validations/isMacAddress.test.d.ts +1 -0
  42. package/dist/tests/validations/isMacAddress.test.js +72 -0
  43. package/dist/tests/validations/isPanagram.test.d.ts +1 -0
  44. package/dist/tests/validations/isPanagram.test.js +39 -0
  45. package/dist/tests/validations/isUpperCase.test.d.ts +1 -0
  46. package/dist/tests/validations/isUpperCase.test.js +50 -0
  47. package/dist/transformations/index.d.ts +9 -0
  48. package/dist/transformations/index.js +14 -2
  49. package/dist/transformations/reverseWordsInString .d.ts +9 -0
  50. package/dist/transformations/reverseWordsInString .js +49 -0
  51. package/dist/transformations/stringCombinations.d.ts +28 -0
  52. package/dist/transformations/stringCombinations.js +44 -0
  53. package/dist/transformations/stringPermutations.d.ts +31 -0
  54. package/dist/transformations/stringPermutations.js +53 -0
  55. package/dist/validations/index.d.ts +21 -0
  56. package/dist/validations/index.js +30 -2
  57. package/dist/validations/isAlphaNumeric.d.ts +11 -0
  58. package/dist/validations/isAlphaNumeric.js +22 -0
  59. package/dist/validations/isAlphabetic.d.ts +9 -0
  60. package/dist/validations/isAlphabetic.js +21 -0
  61. package/dist/validations/isAnagram.d.ts +13 -0
  62. package/dist/validations/isAnagram.js +23 -0
  63. package/dist/validations/isLowerCase.d.ts +12 -0
  64. package/dist/validations/isLowerCase.js +32 -0
  65. package/dist/validations/isMacAddress.d.ts +27 -0
  66. package/dist/validations/isMacAddress.js +43 -0
  67. package/dist/validations/isPanagram.d.ts +20 -0
  68. package/dist/validations/isPanagram.js +35 -0
  69. package/dist/validations/isUpperCase.d.ts +12 -0
  70. package/dist/validations/isUpperCase.js +32 -0
  71. package/package.json +3 -3
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Checks whether the second string is a subsequence of the first string.
3
+ *
4
+ * A subsequence means all characters of the second string appear in the first string
5
+ * in the same relative order, but not necessarily consecutively.
6
+ *
7
+ * Is case sensitive
8
+ *
9
+ * @param {string} str1 - The string to check against.
10
+ * @param {string} str2 - The candidate subsequence.
11
+ * @returns {boolean} True if str2 is a subsequence of str1, otherwise false.
12
+ * @throws {TypeError} If either input is not a string.
13
+ */
14
+ export declare function checkSubsequence(str1: string, str2: string): boolean;
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.checkSubsequence = checkSubsequence;
4
+ /**
5
+ * Checks whether the second string is a subsequence of the first string.
6
+ *
7
+ * A subsequence means all characters of the second string appear in the first string
8
+ * in the same relative order, but not necessarily consecutively.
9
+ *
10
+ * Is case sensitive
11
+ *
12
+ * @param {string} str1 - The string to check against.
13
+ * @param {string} str2 - The candidate subsequence.
14
+ * @returns {boolean} True if str2 is a subsequence of str1, otherwise false.
15
+ * @throws {TypeError} If either input is not a string.
16
+ */
17
+ function checkSubsequence(str1, str2) {
18
+ if (typeof str1 !== "string" || typeof str2 !== "string") {
19
+ throw new TypeError("Both inputs must be strings");
20
+ }
21
+ // empty subsequence is always valid
22
+ if (str2 === "")
23
+ return true;
24
+ let i = 0; // pointer for str2 (the subsequence)
25
+ let j = 0; // pointer for str1 (the main string)
26
+ while (i < str2.length && j < str1.length) {
27
+ if (str2[i] === str1[j]) {
28
+ i++;
29
+ }
30
+ j++;
31
+ }
32
+ return i === str2.length;
33
+ }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Counts the number of content words in a given text.
3
+ *
4
+ * Content words are words that carry lexical meaning (nouns, verbs, adjectives, adverbs),
5
+ * excluding function words such as prepositions, pronouns, and articles.
6
+ *
7
+ * @param {string} text - The text to analyze.
8
+ * @returns {number} The count of content words in the text.
9
+ * @throws {TypeError} If the input is not a string.
10
+ */
11
+ export declare function contentWordCount(text: string): number;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.contentWordCount = contentWordCount;
4
+ const functionWordCount_1 = require("./functionWordCount");
5
+ const wordCount_1 = require("./wordCount");
6
+ /**
7
+ * Counts the number of content words in a given text.
8
+ *
9
+ * Content words are words that carry lexical meaning (nouns, verbs, adjectives, adverbs),
10
+ * excluding function words such as prepositions, pronouns, and articles.
11
+ *
12
+ * @param {string} text - The text to analyze.
13
+ * @returns {number} The count of content words in the text.
14
+ * @throws {TypeError} If the input is not a string.
15
+ */
16
+ function contentWordCount(text) {
17
+ if (typeof text !== 'string') {
18
+ throw new TypeError('Input must be a string');
19
+ }
20
+ const totalWords = (0, wordCount_1.wordCount)(text);
21
+ const functionWords = (0, functionWordCount_1.functionWordCount)(text);
22
+ return totalWords - functionWords;
23
+ }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Counts the number of function words in a given text.
3
+ *
4
+ * Function words are common words (e.g., prepositions, pronouns, conjunctions, articles, etc.)
5
+ * that carry grammatical meaning rather than lexical meaning.
6
+ *
7
+ * @param {string} text - The text to analyze.
8
+ * @returns {number} The count of function words in the text.
9
+ * @throws {TypeError} If the input is not a string.
10
+ */
11
+ export declare function functionWordCount(text: string): number;
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.functionWordCount = functionWordCount;
4
+ /**
5
+ * Counts the number of function words in a given text.
6
+ *
7
+ * Function words are common words (e.g., prepositions, pronouns, conjunctions, articles, etc.)
8
+ * that carry grammatical meaning rather than lexical meaning.
9
+ *
10
+ * @param {string} text - The text to analyze.
11
+ * @returns {number} The count of function words in the text.
12
+ * @throws {TypeError} If the input is not a string.
13
+ */
14
+ function functionWordCount(text) {
15
+ if (typeof text !== 'string') {
16
+ throw new TypeError('Input must be a string');
17
+ }
18
+ const functionWords = new Set([
19
+ 'a', 'an', 'the', 'and', 'but', 'or', 'nor', 'so', 'yet',
20
+ 'for', 'of', 'in', 'on', 'at', 'by', 'to', 'from', 'with', 'about',
21
+ 'as', 'into', 'like', 'through', 'after', 'over', 'between', 'out',
22
+ 'against', 'during', 'without', 'before', 'under', 'around', 'among',
23
+ 'is', 'am', 'are', 'was', 'were', 'be', 'been', 'being',
24
+ 'he', 'she', 'it', 'they', 'we', 'you', 'i', 'me', 'him', 'her',
25
+ 'them', 'us', 'my', 'your', 'his', 'their', 'our',
26
+ 'this', 'that', 'these', 'those',
27
+ 'who', 'whom', 'which', 'what', 'when', 'where', 'why', 'how'
28
+ ]);
29
+ // ✅ Normalize text: lowercase + remove punctuation
30
+ const cleanedText = text.toLowerCase().replace(/[^\w\s]/g, '');
31
+ const words = cleanedText.trim().split(/\s+/);
32
+ return words.filter(word => functionWords.has(word)).length;
33
+ }
@@ -6,6 +6,11 @@ export { wordCount } from './wordCount';
6
6
  export { stringSimilarity } from './stringSimilarity';
7
7
  export { patternCount } from './patternCount';
8
8
  export { vowelConsonantCount } from './vowelConsonantCount';
9
+ export { checkMultiplePatterns } from './checkMultiplePatterns';
10
+ export { checkSubsequence } from './checkSubsequence';
11
+ export { functionWordCount } from './functionWordCount';
12
+ export { contentWordCount } from './contentWordCount';
13
+ export { checkStringRotations } from './stringRotation';
9
14
  import { characterCount } from './characterCount';
10
15
  import { characterFrequency } from './characterFrequency';
11
16
  import { complexity } from './complexity';
@@ -14,6 +19,9 @@ import { wordCount } from './wordCount';
14
19
  import { stringSimilarity } from './stringSimilarity';
15
20
  import { patternCount } from './patternCount';
16
21
  import { vowelConsonantCount } from './vowelConsonantCount';
22
+ import { checkMultiplePatterns } from './checkMultiplePatterns';
23
+ import { checkSubsequence } from './checkSubsequence';
24
+ import { checkStringRotations } from './stringRotation';
17
25
  export declare const analyzing: {
18
26
  characterCount: typeof characterCount;
19
27
  characterFrequency: typeof characterFrequency;
@@ -23,4 +31,7 @@ export declare const analyzing: {
23
31
  stringSimilarity: typeof stringSimilarity;
24
32
  patternCount: typeof patternCount;
25
33
  vowelConsonantCount: typeof vowelConsonantCount;
34
+ checkMultiplePatterns: typeof checkMultiplePatterns;
35
+ checkSubsequence: typeof checkSubsequence;
36
+ checkStringRotations: typeof checkStringRotations;
26
37
  };
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.analyzing = exports.vowelConsonantCount = exports.patternCount = exports.stringSimilarity = exports.wordCount = exports.readingDuration = exports.complexity = exports.characterFrequency = exports.characterCount = void 0;
3
+ exports.analyzing = exports.checkStringRotations = exports.contentWordCount = exports.functionWordCount = exports.checkSubsequence = exports.checkMultiplePatterns = exports.vowelConsonantCount = exports.patternCount = exports.stringSimilarity = exports.wordCount = exports.readingDuration = exports.complexity = exports.characterFrequency = exports.characterCount = void 0;
4
4
  var characterCount_1 = require("./characterCount");
5
5
  Object.defineProperty(exports, "characterCount", { enumerable: true, get: function () { return characterCount_1.characterCount; } });
6
6
  var characterFrequency_1 = require("./characterFrequency");
@@ -17,6 +17,16 @@ var patternCount_1 = require("./patternCount");
17
17
  Object.defineProperty(exports, "patternCount", { enumerable: true, get: function () { return patternCount_1.patternCount; } });
18
18
  var vowelConsonantCount_1 = require("./vowelConsonantCount");
19
19
  Object.defineProperty(exports, "vowelConsonantCount", { enumerable: true, get: function () { return vowelConsonantCount_1.vowelConsonantCount; } });
20
+ var checkMultiplePatterns_1 = require("./checkMultiplePatterns");
21
+ Object.defineProperty(exports, "checkMultiplePatterns", { enumerable: true, get: function () { return checkMultiplePatterns_1.checkMultiplePatterns; } });
22
+ var checkSubsequence_1 = require("./checkSubsequence");
23
+ Object.defineProperty(exports, "checkSubsequence", { enumerable: true, get: function () { return checkSubsequence_1.checkSubsequence; } });
24
+ var functionWordCount_1 = require("./functionWordCount");
25
+ Object.defineProperty(exports, "functionWordCount", { enumerable: true, get: function () { return functionWordCount_1.functionWordCount; } });
26
+ var contentWordCount_1 = require("./contentWordCount");
27
+ Object.defineProperty(exports, "contentWordCount", { enumerable: true, get: function () { return contentWordCount_1.contentWordCount; } });
28
+ var stringRotation_1 = require("./stringRotation");
29
+ Object.defineProperty(exports, "checkStringRotations", { enumerable: true, get: function () { return stringRotation_1.checkStringRotations; } });
20
30
  const characterCount_2 = require("./characterCount");
21
31
  const characterFrequency_2 = require("./characterFrequency");
22
32
  const complexity_2 = require("./complexity");
@@ -25,6 +35,9 @@ const wordCount_2 = require("./wordCount");
25
35
  const stringSimilarity_2 = require("./stringSimilarity");
26
36
  const patternCount_2 = require("./patternCount");
27
37
  const vowelConsonantCount_2 = require("./vowelConsonantCount");
38
+ const checkMultiplePatterns_2 = require("./checkMultiplePatterns");
39
+ const checkSubsequence_2 = require("./checkSubsequence");
40
+ const stringRotation_2 = require("./stringRotation");
28
41
  exports.analyzing = {
29
42
  characterCount: characterCount_2.characterCount,
30
43
  characterFrequency: characterFrequency_2.characterFrequency,
@@ -33,5 +46,8 @@ exports.analyzing = {
33
46
  wordCount: wordCount_2.wordCount,
34
47
  stringSimilarity: stringSimilarity_2.stringSimilarity,
35
48
  patternCount: patternCount_2.patternCount,
36
- vowelConsonantCount: vowelConsonantCount_2.vowelConsonantCount
49
+ vowelConsonantCount: vowelConsonantCount_2.vowelConsonantCount,
50
+ checkMultiplePatterns: checkMultiplePatterns_2.checkMultiplePatterns,
51
+ checkSubsequence: checkSubsequence_2.checkSubsequence,
52
+ checkStringRotations: stringRotation_2.checkStringRotations
37
53
  };
@@ -1,10 +1,11 @@
1
1
  /**
2
- * Calculates the number of times a specific pattern occurs in a given text, including overlapping occurrences
2
+ * Counts the number of times a specific pattern occurs in a given text,
3
+ * including overlapping occurrences.
3
4
  *
4
- * The algorithm used here is based on the Knuth-Morris-Pratt (KMP) pattern matching algorithm for better performance
5
+ * Uses the Knuth-Morris-Pratt (KMP) pattern matching algorithm for efficient searching.
5
6
  *
6
- * @param {string} text - The text for which we want to count the occurrences of a specific pattern.
7
- * @param {string} pattern - The pattern to search for within the text.
8
- * @returns {number} - The number of times the pattern occurs in the text (overlapping).
7
+ * @param text - The text to search within
8
+ * @param pattern - The pattern to count
9
+ * @returns The number of times the pattern occurs (including overlapping)
9
10
  */
10
11
  export declare function patternCount(text: string, pattern: string): number;
@@ -2,50 +2,52 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.patternCount = patternCount;
4
4
  /**
5
- * Calculates the number of times a specific pattern occurs in a given text, including overlapping occurrences
5
+ * Counts the number of times a specific pattern occurs in a given text,
6
+ * including overlapping occurrences.
6
7
  *
7
- * The algorithm used here is based on the Knuth-Morris-Pratt (KMP) pattern matching algorithm for better performance
8
+ * Uses the Knuth-Morris-Pratt (KMP) pattern matching algorithm for efficient searching.
8
9
  *
9
- * @param {string} text - The text for which we want to count the occurrences of a specific pattern.
10
- * @param {string} pattern - The pattern to search for within the text.
11
- * @returns {number} - The number of times the pattern occurs in the text (overlapping).
10
+ * @param text - The text to search within
11
+ * @param pattern - The pattern to count
12
+ * @returns The number of times the pattern occurs (including overlapping)
12
13
  */
13
14
  function patternCount(text, pattern) {
14
- if (pattern.length === 0) {
15
- return 0; // No pattern to search for
16
- }
15
+ if (!pattern)
16
+ return 0; // Return 0 for empty pattern
17
17
  const prefixFunction = computePrefixFunction(pattern);
18
18
  let count = 0;
19
19
  let j = 0; // Index for pattern
20
20
  for (let i = 0; i < text.length; i++) {
21
21
  while (j > 0 && text[i] !== pattern[j]) {
22
- j = prefixFunction[j - 1];
22
+ j = prefixFunction[j - 1]; // fallback in pattern
23
23
  }
24
- if (text[i] === pattern[j]) {
24
+ if (text[i] === pattern[j])
25
25
  j++;
26
- }
27
26
  if (j === pattern.length) {
28
27
  count++;
29
- j = prefixFunction[j - 1]; // Allow for overlapping matches
28
+ j = prefixFunction[j - 1]; // allow overlapping matches
30
29
  }
31
30
  }
32
31
  return count;
33
32
  }
34
33
  /**
35
34
  * Computes the prefix function (partial match table) for KMP algorithm.
36
- * @param {string} pattern - The pattern string.
37
- * @returns {number[]} - The prefix function array.
35
+ *
36
+ * The prefix function stores the length of the longest proper prefix
37
+ * which is also a suffix for each prefix of the pattern.
38
+ *
39
+ * @param pattern - Pattern string
40
+ * @returns Array of prefix lengths
38
41
  */
39
42
  function computePrefixFunction(pattern) {
40
43
  const prefixFunction = new Array(pattern.length).fill(0);
41
44
  let j = 0;
42
45
  for (let i = 1; i < pattern.length; i++) {
43
46
  while (j > 0 && pattern[i] !== pattern[j]) {
44
- j = prefixFunction[j - 1];
47
+ j = prefixFunction[j - 1]; // fallback
45
48
  }
46
- if (pattern[i] === pattern[j]) {
49
+ if (pattern[i] === pattern[j])
47
50
  j++;
48
- }
49
51
  prefixFunction[i] = j;
50
52
  }
51
53
  return prefixFunction;
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Checks if one string is a rotation of another.
3
+ *
4
+ * A string `str2` is a rotation of `str1` if it can be obtained by shifting
5
+ * the characters of `str1` in a circular fashion.
6
+ *
7
+ * The check is case-sensitive and supports special characters and numbers.
8
+ *
9
+ * @param {string} str1 - The original string.
10
+ * @param {string} str2 - The string to check if it is a rotation of str1.
11
+ * @returns {boolean} True if str2 is a rotation of str1, otherwise false.
12
+ * @throws {TypeError} If either input is not a string.
13
+ *
14
+ * @example
15
+ * checkStringRotations("abcd", "cdab"); // true
16
+ *
17
+ * @example
18
+ * checkStringRotations("abc", "acb"); // false
19
+ *
20
+ * @example
21
+ * checkStringRotations("hello", "ohell"); // true
22
+ *
23
+ * @example
24
+ * checkStringRotations("", ""); // true
25
+ *
26
+ * @example
27
+ * checkStringRotations("abc", "ab"); // false
28
+ */
29
+ export declare function checkStringRotations(str1: string, str2: string): boolean;
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.checkStringRotations = checkStringRotations;
4
+ /**
5
+ * Checks if one string is a rotation of another.
6
+ *
7
+ * A string `str2` is a rotation of `str1` if it can be obtained by shifting
8
+ * the characters of `str1` in a circular fashion.
9
+ *
10
+ * The check is case-sensitive and supports special characters and numbers.
11
+ *
12
+ * @param {string} str1 - The original string.
13
+ * @param {string} str2 - The string to check if it is a rotation of str1.
14
+ * @returns {boolean} True if str2 is a rotation of str1, otherwise false.
15
+ * @throws {TypeError} If either input is not a string.
16
+ *
17
+ * @example
18
+ * checkStringRotations("abcd", "cdab"); // true
19
+ *
20
+ * @example
21
+ * checkStringRotations("abc", "acb"); // false
22
+ *
23
+ * @example
24
+ * checkStringRotations("hello", "ohell"); // true
25
+ *
26
+ * @example
27
+ * checkStringRotations("", ""); // true
28
+ *
29
+ * @example
30
+ * checkStringRotations("abc", "ab"); // false
31
+ */
32
+ function checkStringRotations(str1, str2) {
33
+ if (typeof str1 !== 'string' || typeof str2 !== 'string') {
34
+ throw new TypeError('Both inputs must be strings');
35
+ }
36
+ // Edge case: both empty strings
37
+ if (str1 === '' && str2 === '')
38
+ return true;
39
+ // If lengths differ, they cannot be rotations
40
+ if (str1.length !== str2.length)
41
+ return false;
42
+ // Concatenate str1 with itself and check if str2 is a substring
43
+ return (str1 + str1).includes(str2);
44
+ }
package/dist/index.d.ts CHANGED
@@ -12,6 +12,9 @@ declare const _default: {
12
12
  stringSimilarity: typeof import("./analyzing").stringSimilarity;
13
13
  patternCount: typeof import("./analyzing").patternCount;
14
14
  vowelConsonantCount: typeof import("./analyzing").vowelConsonantCount;
15
+ checkMultiplePatterns: typeof import("./analyzing").checkMultiplePatterns;
16
+ checkSubsequence: typeof import("./analyzing").checkSubsequence;
17
+ checkStringRotations: typeof import("./analyzing").checkStringRotations;
15
18
  };
16
19
  formatting: {
17
20
  capitalize: typeof import("./formatting").capitalize;
@@ -36,6 +39,9 @@ declare const _default: {
36
39
  maskSegment: typeof import("./transformations").maskSegment;
37
40
  deburr: typeof import("./transformations/deburr").deburr;
38
41
  numberToText: typeof import("./transformations").numberToText;
42
+ reverseWordsInString: typeof import("./transformations").reverseWordsInString;
43
+ stringPermutations: typeof import("./transformations").stringPermutations;
44
+ stringCombinations: typeof import("./transformations").stringCombinations;
39
45
  };
40
46
  validations: {
41
47
  isCoordinates: typeof import("./validations").isCoordinates;
@@ -47,6 +53,13 @@ declare const _default: {
47
53
  isIPv4: typeof import("./validations").isIPv4;
48
54
  isHexColor: typeof import("./validations").isHexColor;
49
55
  isPalindrome: typeof import("./validations").isPalindrome;
56
+ isLowerCase: typeof import("./validations").isLowerCase;
57
+ isUpperCase: typeof import("./validations").isUpperCase;
58
+ isAlphabetic: typeof import("./validations").isAlphabetic;
59
+ isAlphaNumeric: typeof import("./validations").isAlphaNumeric;
60
+ isAnagram: typeof import("./validations").isAnagram;
61
+ isPanagram: typeof import("./validations").isPanagram;
62
+ isMacAddress: typeof import("./validations").isMacAddress;
50
63
  };
51
64
  };
52
65
  export default _default;
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const node_test_1 = require("node:test");
7
+ const node_assert_1 = __importDefault(require("node:assert"));
8
+ const checkMultiplePatterns_1 = require("../../analyzing/checkMultiplePatterns");
9
+ (0, node_test_1.describe)('checkMultiplePatterns', () => {
10
+ (0, node_test_1.it)('finds multiple valid matches', () => {
11
+ const text = 'abracadabra';
12
+ const patterns = ['abra', 'cad'];
13
+ const result = (0, checkMultiplePatterns_1.checkMultiplePatterns)(text, patterns);
14
+ // "abra" occurs at index 0: "abra...cadabra"
15
+ // and again at index 7: "abracad...abra"
16
+ node_assert_1.default.deepStrictEqual(result['abra'], [0, 7]);
17
+ // "cad" occurs once starting at index 4: "abraCADabra"
18
+ node_assert_1.default.deepStrictEqual(result['cad'], [4]);
19
+ });
20
+ (0, node_test_1.it)('handles overlapping patterns', () => {
21
+ const text = 'aaaa';
22
+ const patterns = ['aa', 'aaa'];
23
+ const result = (0, checkMultiplePatterns_1.checkMultiplePatterns)(text, patterns);
24
+ // "aa" occurs at indices 0 ("aa.."), 1 (".aa."), 2 ("..aa")
25
+ node_assert_1.default.deepStrictEqual(result['aa'], [0, 1, 2]);
26
+ // "aaa" occurs at indices 0 ("aaa.") and 1 (".aaa")
27
+ node_assert_1.default.deepStrictEqual(result['aaa'], [0, 1]);
28
+ });
29
+ (0, node_test_1.it)('returns empty arrays when no matches found', () => {
30
+ const text = 'hello world';
31
+ const patterns = ['xyz', '123'];
32
+ const result = (0, checkMultiplePatterns_1.checkMultiplePatterns)(text, patterns);
33
+ // Neither "xyz" nor "123" exist in "hello world"
34
+ node_assert_1.default.deepStrictEqual(result['xyz'], []);
35
+ node_assert_1.default.deepStrictEqual(result['123'], []);
36
+ });
37
+ (0, node_test_1.it)('returns empty object when text is empty', () => {
38
+ // No text to search → nothing to return
39
+ const result = (0, checkMultiplePatterns_1.checkMultiplePatterns)('', ['a', 'b']);
40
+ node_assert_1.default.deepStrictEqual(result, {});
41
+ });
42
+ (0, node_test_1.it)('returns empty object when patterns array is empty', () => {
43
+ // No patterns given → nothing to search for
44
+ const result = (0, checkMultiplePatterns_1.checkMultiplePatterns)('hello', []);
45
+ node_assert_1.default.deepStrictEqual(result, {});
46
+ });
47
+ (0, node_test_1.it)('skips patterns longer than the text', () => {
48
+ const result = (0, checkMultiplePatterns_1.checkMultiplePatterns)('hi', ['longpattern']);
49
+ // pattern is longer than text → no match possible
50
+ node_assert_1.default.deepStrictEqual(result['longpattern'], []);
51
+ });
52
+ (0, node_test_1.it)('is case-sensitive by default', () => {
53
+ const text = 'Hello hello';
54
+ const patterns = ['Hello', 'hello'];
55
+ const result = (0, checkMultiplePatterns_1.checkMultiplePatterns)(text, patterns);
56
+ node_assert_1.default.deepStrictEqual(result['Hello'], [0]);
57
+ node_assert_1.default.deepStrictEqual(result['hello'], [6]);
58
+ });
59
+ (0, node_test_1.it)('handles spaces and special characters as part of patterns', () => {
60
+ const text = 'hi there!';
61
+ const patterns = [' ', '!'];
62
+ const result = (0, checkMultiplePatterns_1.checkMultiplePatterns)(text, patterns);
63
+ // space occurs at index 2, "!" occurs at the end
64
+ node_assert_1.default.deepStrictEqual(result[' '], [2]);
65
+ node_assert_1.default.deepStrictEqual(result['!'], [8]);
66
+ });
67
+ (0, node_test_1.it)('does not match mixed case unless exact', () => {
68
+ const text = 'RabinKarp';
69
+ const patterns = ['rabinkarp'];
70
+ const result = (0, checkMultiplePatterns_1.checkMultiplePatterns)(text, patterns);
71
+ // "rabinkarp" does not match "RabinKarp" because of case
72
+ node_assert_1.default.deepStrictEqual(result['rabinkarp'], []);
73
+ });
74
+ (0, node_test_1.it)('throws if text is not a string', () => {
75
+ node_assert_1.default.throws(() => (0, checkMultiplePatterns_1.checkMultiplePatterns)(123, ['a']), /Text must be a string/);
76
+ });
77
+ (0, node_test_1.it)('throws if patterns is not an array of strings', () => {
78
+ node_assert_1.default.throws(() => (0, checkMultiplePatterns_1.checkMultiplePatterns)('abc', 'a'), /Patterns must be an array of strings/);
79
+ node_assert_1.default.throws(() => (0, checkMultiplePatterns_1.checkMultiplePatterns)('abc', [123]), /Patterns must be an array of strings/);
80
+ });
81
+ });
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const node_test_1 = require("node:test");
7
+ const node_assert_1 = __importDefault(require("node:assert"));
8
+ const checkSubsequence_1 = require("../../analyzing/checkSubsequence");
9
+ (0, node_test_1.describe)('checkSubsequence', () => {
10
+ (0, node_test_1.it)('returns true for valid subsequences', () => {
11
+ node_assert_1.default.strictEqual((0, checkSubsequence_1.checkSubsequence)('abcde', 'ace'), true);
12
+ node_assert_1.default.strictEqual((0, checkSubsequence_1.checkSubsequence)('abracadabra', 'aaa'), true);
13
+ node_assert_1.default.strictEqual((0, checkSubsequence_1.checkSubsequence)('hello world', 'hlo'), true);
14
+ });
15
+ (0, node_test_1.it)('returns false when order is broken', () => {
16
+ node_assert_1.default.strictEqual((0, checkSubsequence_1.checkSubsequence)('abcde', 'aec'), false);
17
+ node_assert_1.default.strictEqual((0, checkSubsequence_1.checkSubsequence)('abcdef', 'z'), false);
18
+ });
19
+ (0, node_test_1.it)('handles empty subsequence', () => {
20
+ node_assert_1.default.strictEqual((0, checkSubsequence_1.checkSubsequence)('anything', ''), true);
21
+ });
22
+ (0, node_test_1.it)('is case-sensitive', () => {
23
+ node_assert_1.default.strictEqual((0, checkSubsequence_1.checkSubsequence)('abc', 'A'), false);
24
+ node_assert_1.default.strictEqual((0, checkSubsequence_1.checkSubsequence)('AbC', 'AC'), true);
25
+ });
26
+ (0, node_test_1.it)('handles spaces as normal characters', () => {
27
+ node_assert_1.default.strictEqual((0, checkSubsequence_1.checkSubsequence)('a b c', 'abc'), true);
28
+ node_assert_1.default.strictEqual((0, checkSubsequence_1.checkSubsequence)('a b c', 'a c'), true);
29
+ });
30
+ (0, node_test_1.it)('throws if inputs are not strings', () => {
31
+ node_assert_1.default.throws(() => (0, checkSubsequence_1.checkSubsequence)(123, 'abc'), /Both inputs must be strings/);
32
+ node_assert_1.default.throws(() => (0, checkSubsequence_1.checkSubsequence)('abc', null), /Both inputs must be strings/);
33
+ });
34
+ });
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const node_test_1 = __importDefault(require("node:test"));
7
+ const strict_1 = __importDefault(require("node:assert/strict"));
8
+ const contentWordCount_js_1 = require("../../analyzing/contentWordCount.js");
9
+ (0, node_test_1.default)("counts content words in a normal sentence", () => {
10
+ strict_1.default.equal((0, contentWordCount_js_1.contentWordCount)("This is a test of the system"), 2);
11
+ });
12
+ (0, node_test_1.default)("returns 0 when there are no content words", () => {
13
+ strict_1.default.equal((0, contentWordCount_js_1.contentWordCount)("is the at of"), 0);
14
+ });
15
+ (0, node_test_1.default)("ignores case and punctuation", () => {
16
+ strict_1.default.equal((0, contentWordCount_js_1.contentWordCount)("Elephants, ELEPHANTS, elephants!"), 3);
17
+ });
18
+ (0, node_test_1.default)("returns 0 for empty string", () => {
19
+ strict_1.default.equal((0, contentWordCount_js_1.contentWordCount)(""), 0);
20
+ });
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const node_test_1 = __importDefault(require("node:test"));
7
+ const strict_1 = __importDefault(require("node:assert/strict"));
8
+ const functionWordCount_js_1 = require("../../analyzing/functionWordCount.js");
9
+ (0, node_test_1.default)("counts function words in a normal sentence", () => {
10
+ strict_1.default.equal((0, functionWordCount_js_1.functionWordCount)("This is a test of the system"), 5);
11
+ });
12
+ (0, node_test_1.default)("returns 0 when there are no function words", () => {
13
+ strict_1.default.equal((0, functionWordCount_js_1.functionWordCount)("Elephants run fast"), 0);
14
+ });
15
+ (0, node_test_1.default)("ignores case and punctuation", () => {
16
+ strict_1.default.equal((0, functionWordCount_js_1.functionWordCount)("The, THE, the!"), 3);
17
+ });
18
+ (0, node_test_1.default)("returns 0 for empty string", () => {
19
+ strict_1.default.equal((0, functionWordCount_js_1.functionWordCount)(""), 0);
20
+ });
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const node_test_1 = require("node:test");
7
+ const node_assert_1 = __importDefault(require("node:assert"));
8
+ const stringRotation_1 = require("../../analyzing/stringRotation");
9
+ (0, node_test_1.describe)('checkStringRotations', () => {
10
+ (0, node_test_1.it)('returns true for valid rotations', () => {
11
+ node_assert_1.default.strictEqual((0, stringRotation_1.checkStringRotations)('abcd', 'cdab'), true);
12
+ node_assert_1.default.strictEqual((0, stringRotation_1.checkStringRotations)('hello', 'ohell'), true);
13
+ node_assert_1.default.strictEqual((0, stringRotation_1.checkStringRotations)('12345', '45123'), true);
14
+ node_assert_1.default.strictEqual((0, stringRotation_1.checkStringRotations)('!@#$', '#$!@'), true);
15
+ });
16
+ (0, node_test_1.it)('returns false for invalid rotations', () => {
17
+ node_assert_1.default.strictEqual((0, stringRotation_1.checkStringRotations)('abc', 'acb'), false);
18
+ node_assert_1.default.strictEqual((0, stringRotation_1.checkStringRotations)('hello', 'helol'), false);
19
+ node_assert_1.default.strictEqual((0, stringRotation_1.checkStringRotations)('12345', '54321'), false);
20
+ });
21
+ (0, node_test_1.it)('is case-sensitive', () => {
22
+ node_assert_1.default.strictEqual((0, stringRotation_1.checkStringRotations)('ArB', 'Bar'), false);
23
+ node_assert_1.default.strictEqual((0, stringRotation_1.checkStringRotations)('Case', 'case'), false);
24
+ node_assert_1.default.strictEqual((0, stringRotation_1.checkStringRotations)('XYZ', 'yzx'), false);
25
+ });
26
+ (0, node_test_1.it)('returns true for empty strings', () => {
27
+ node_assert_1.default.strictEqual((0, stringRotation_1.checkStringRotations)('', ''), true);
28
+ });
29
+ (0, node_test_1.it)('returns false for strings of different lengths', () => {
30
+ node_assert_1.default.strictEqual((0, stringRotation_1.checkStringRotations)('abc', 'ab'), false);
31
+ node_assert_1.default.strictEqual((0, stringRotation_1.checkStringRotations)('abcd', ''), false);
32
+ });
33
+ (0, node_test_1.it)('handles special characters correctly', () => {
34
+ node_assert_1.default.strictEqual((0, stringRotation_1.checkStringRotations)('a@b$c', 'b$ca@'), true);
35
+ node_assert_1.default.strictEqual((0, stringRotation_1.checkStringRotations)('a@b$c', 'c$a@b'), false);
36
+ });
37
+ (0, node_test_1.it)('throws an error if inputs are not strings', () => {
38
+ node_assert_1.default.throws(() => (0, stringRotation_1.checkStringRotations)(123, '123'), /Both inputs must be strings/);
39
+ node_assert_1.default.throws(() => (0, stringRotation_1.checkStringRotations)('abc', null), /Both inputs must be strings/);
40
+ node_assert_1.default.throws(() => (0, stringRotation_1.checkStringRotations)(undefined, 'abc'), /Both inputs must be strings/);
41
+ });
42
+ });
@@ -0,0 +1 @@
1
+ export {};