humanizrr 1.0.4 → 2.0.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 (70) hide show
  1. package/LICENSE +2 -0
  2. package/README.md +12 -7
  3. package/dist/core/format.d.ts +6 -0
  4. package/dist/core/format.d.ts.map +1 -0
  5. package/dist/core/format.js +59 -0
  6. package/dist/core/format.js.map +1 -0
  7. package/dist/core/markdown.d.ts +6 -0
  8. package/dist/core/markdown.d.ts.map +1 -0
  9. package/dist/core/markdown.js +29 -0
  10. package/dist/core/markdown.js.map +1 -0
  11. package/dist/core/typos.d.ts +15 -0
  12. package/dist/core/typos.d.ts.map +1 -0
  13. package/dist/core/typos.js +147 -0
  14. package/dist/core/typos.js.map +1 -0
  15. package/dist/helpers/levenshtein.d.ts +8 -0
  16. package/dist/helpers/levenshtein.d.ts.map +1 -0
  17. package/dist/helpers/levenshtein.js +43 -0
  18. package/dist/helpers/levenshtein.js.map +1 -0
  19. package/dist/helpers/randomBool.d.ts +6 -0
  20. package/dist/helpers/randomBool.d.ts.map +1 -0
  21. package/dist/helpers/randomBool.js +10 -0
  22. package/dist/helpers/randomBool.js.map +1 -0
  23. package/dist/helpers/randomInt.d.ts +6 -0
  24. package/dist/helpers/randomInt.d.ts.map +1 -0
  25. package/dist/helpers/randomInt.js +12 -0
  26. package/dist/helpers/randomInt.js.map +1 -0
  27. package/dist/helpers/randomLetter.d.ts +7 -0
  28. package/dist/helpers/randomLetter.d.ts.map +1 -0
  29. package/dist/helpers/randomLetter.js +11 -0
  30. package/dist/helpers/randomLetter.js.map +1 -0
  31. package/dist/index.d.ts +13 -0
  32. package/dist/index.d.ts.map +1 -0
  33. package/dist/index.js +15 -0
  34. package/dist/index.js.map +1 -0
  35. package/dist/playground.d.ts +2 -0
  36. package/dist/playground.d.ts.map +1 -0
  37. package/dist/playground.js +21 -0
  38. package/dist/playground.js.map +1 -0
  39. package/dist/types/keyboard.d.ts +6 -0
  40. package/dist/types/keyboard.d.ts.map +1 -0
  41. package/dist/types/keyboard.js +3 -0
  42. package/dist/types/keyboard.js.map +1 -0
  43. package/dist/types/transformer.d.ts +10 -0
  44. package/dist/types/transformer.d.ts.map +1 -0
  45. package/dist/types/transformer.js +3 -0
  46. package/dist/types/transformer.js.map +1 -0
  47. package/eslint.config.mts +18 -0
  48. package/jest.config.js +9 -0
  49. package/nodemon.json +16 -0
  50. package/package.json +30 -13
  51. package/src/core/format.ts +61 -0
  52. package/src/core/markdown.ts +31 -0
  53. package/src/core/typos.ts +159 -0
  54. package/src/data/keyboard/azerty.json +210 -0
  55. package/src/data/keyboard/qwerty.json +191 -0
  56. package/src/helpers/levenshtein.ts +48 -0
  57. package/src/helpers/{randomBool.js → randomBool.ts} +2 -4
  58. package/src/helpers/{randomInt.js → randomInt.ts} +2 -4
  59. package/src/helpers/{randomLetter.js → randomLetter.ts} +2 -4
  60. package/src/index.ts +11 -0
  61. package/src/playground.ts +21 -0
  62. package/src/types/keyboard.ts +10 -0
  63. package/src/types/transformer.ts +13 -0
  64. package/tsconfig.json +46 -0
  65. package/src/data/keyboardMaps.json +0 -403
  66. package/src/helpers/levenshtein.js +0 -55
  67. package/src/index.js +0 -11
  68. package/src/playground.js +0 -11
  69. package/src/utils/spellings.js +0 -16
  70. package/src/utils/typos.js +0 -81
package/LICENSE CHANGED
@@ -1,3 +1,5 @@
1
+ MIT License
2
+
1
3
  Copyright (c) 2025 Anthony Lalba
2
4
 
3
5
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
package/README.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  humanizrr is a Node.js library that provides methods for humanizing strings for AI-generated content.
4
4
 
5
+ Available at: [https://www.npmjs.com/package/humanizrr](https://www.npmjs.com/package/humanizrr)
6
+
5
7
  ## 🚀 - Installation
6
8
 
7
9
  ```bash
@@ -10,12 +12,15 @@ npm install humanizrr
10
12
 
11
13
  ## ✒️ - Usage
12
14
 
13
- ### Make typos
15
+ WIP
16
+
17
+ ## 🛠️ - Development
18
+
19
+ ```bash
20
+ npm version patch
21
+ git push --follow-tags
22
+ ```
14
23
 
15
- ```javascript
16
- const humanizrr = require('humanizrr');
24
+ ## 📄 - License
17
25
 
18
- const text = "I am the one who knocks.";
19
- console.log(humanizrr.typos.make(text, { percentage: 0.01, types: ['swap', 'map'], keyboard: 'qwerty' }));
20
- // Output will be something like: "I am the one who knoks."
21
- ```
26
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
@@ -0,0 +1,6 @@
1
+ declare function all(text: string): string;
2
+ declare const _default: {
3
+ all: typeof all;
4
+ };
5
+ export default _default;
6
+ //# sourceMappingURL=format.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../src/core/format.ts"],"names":[],"mappings":"AA+CA,iBAAS,GAAG,CAAC,IAAI,EAAE,MAAM,UAWxB;;;;AAED,wBAAuB"}
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const transformers = {
4
+ removeEmojis: {
5
+ description: 'Remove all emojis from the text',
6
+ callback: (str) => {
7
+ return str.replace(/\p{Extended_Pictographic}/gu, '');
8
+ }
9
+ },
10
+ normalizeQuotes: {
11
+ description: 'Normalize quotes',
12
+ callback: (str) => {
13
+ return str
14
+ .replace(/[“”]/g, '"')
15
+ .replace(/[‘’]/g, "'");
16
+ }
17
+ },
18
+ normalizeSpecialCharacters: {
19
+ description: 'Normalize special characters',
20
+ callback: (str) => {
21
+ return str
22
+ .replace(/—/g, '-')
23
+ .replace(/…/g, '...')
24
+ .replace(/œ/g, 'oe')
25
+ .replace(/→/g, '->');
26
+ }
27
+ },
28
+ removeDoubleSpaces: {
29
+ description: 'Remove all double spaces from the text',
30
+ callback: (str) => {
31
+ return str.replace(/\s{2,}/g, ' ');
32
+ }
33
+ },
34
+ removeDoubleNewLines: {
35
+ description: 'Remove all double new lines from the text',
36
+ callback: (str) => {
37
+ return str.replace(/\n{2,}/g, '\n');
38
+ }
39
+ },
40
+ normalizeSentenceEnd: {
41
+ description: 'Remove all spaces before end of sentence punctuation',
42
+ callback: (str) => {
43
+ return str.replace(/\s+([.!?])/g, '$1');
44
+ }
45
+ },
46
+ };
47
+ function all(text) {
48
+ if (!text)
49
+ return text;
50
+ for (const key in transformers) {
51
+ const transformer = transformers[key];
52
+ if (transformer)
53
+ text = transformer.callback(text);
54
+ }
55
+ text = text.trim();
56
+ return text;
57
+ }
58
+ exports.default = { all };
59
+ //# sourceMappingURL=format.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format.js","sourceRoot":"","sources":["../../src/core/format.ts"],"names":[],"mappings":";;AAEA,MAAM,YAAY,GAA0B;IACxC,YAAY,EAAE;QACV,WAAW,EAAE,iCAAiC;QAC9C,QAAQ,EAAE,CAAC,GAAW,EAAE,EAAE;YACtB,OAAO,GAAG,CAAC,OAAO,CAAC,6BAA6B,EAAE,EAAE,CAAC,CAAC;QAC1D,CAAC;KACJ;IACD,eAAe,EAAE;QACb,WAAW,EAAE,kBAAkB;QAC/B,QAAQ,EAAE,CAAC,GAAW,EAAE,EAAE;YACtB,OAAO,GAAG;iBACL,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC;iBACrB,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,CAAA;QAC9B,CAAC;KACJ;IACD,0BAA0B,EAAE;QACxB,WAAW,EAAE,8BAA8B;QAC3C,QAAQ,EAAE,CAAC,GAAW,EAAE,EAAE;YACtB,OAAO,GAAG;iBACL,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC;iBAClB,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC;iBACpB,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC;iBACnB,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAC7B,CAAC;KACJ;IACD,kBAAkB,EAAE;QAChB,WAAW,EAAE,wCAAwC;QACrD,QAAQ,EAAE,CAAC,GAAW,EAAE,EAAE;YACtB,OAAO,GAAG,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC;QACvC,CAAC;KACJ;IACD,oBAAoB,EAAE;QAClB,WAAW,EAAE,2CAA2C;QACxD,QAAQ,EAAE,CAAC,GAAW,EAAE,EAAE;YACtB,OAAO,GAAG,CAAC,OAAO,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;QACxC,CAAC;KACJ;IACD,oBAAoB,EAAE;QAClB,WAAW,EAAE,sDAAsD;QACnE,QAAQ,EAAE,CAAC,GAAW,EAAE,EAAE;YACtB,OAAO,GAAG,CAAC,OAAO,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC;QAC5C,CAAC;KACJ;CACJ,CAAA;AAED,SAAS,GAAG,CAAC,IAAY;IACrB,IAAI,CAAC,IAAI;QAAE,OAAO,IAAI,CAAC;IAEvB,KAAK,MAAM,GAAG,IAAI,YAAY,EAAE,CAAC;QAC7B,MAAM,WAAW,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC;QACtC,IAAI,WAAW;YAAE,IAAI,GAAG,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IACvD,CAAC;IAED,IAAI,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;IAEnB,OAAO,IAAI,CAAC;AAChB,CAAC;AAED,kBAAe,EAAE,GAAG,EAAE,CAAC"}
@@ -0,0 +1,6 @@
1
+ declare function all(text: string): string;
2
+ declare const _default: {
3
+ all: typeof all;
4
+ };
5
+ export default _default;
6
+ //# sourceMappingURL=markdown.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"markdown.d.ts","sourceRoot":"","sources":["../../src/core/markdown.ts"],"names":[],"mappings":"AAiBA,iBAAS,GAAG,CAAC,IAAI,EAAE,MAAM,UAWxB;;;;AAED,wBAAuB"}
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const transformers = {
4
+ removeBold: {
5
+ description: 'Remove all bold from the text',
6
+ callback: (str) => {
7
+ return str.replace(/\*\*(.*?)\*\*/g, '$1');
8
+ }
9
+ },
10
+ removeDashedLines: {
11
+ description: 'Remove all 3 dashes lines from the text',
12
+ callback: (str) => {
13
+ return str.replace(/^-{3,}$/gm, '');
14
+ }
15
+ },
16
+ };
17
+ function all(text) {
18
+ if (!text)
19
+ return text;
20
+ for (const key in transformers) {
21
+ const transformer = transformers[key];
22
+ if (transformer)
23
+ text = transformer.callback(text);
24
+ }
25
+ text = text.trim();
26
+ return text;
27
+ }
28
+ exports.default = { all };
29
+ //# sourceMappingURL=markdown.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"markdown.js","sourceRoot":"","sources":["../../src/core/markdown.ts"],"names":[],"mappings":";;AAEA,MAAM,YAAY,GAA0B;IACxC,UAAU,EAAE;QACR,WAAW,EAAE,+BAA+B;QAC5C,QAAQ,EAAE,CAAC,GAAW,EAAE,EAAE;YACtB,OAAO,GAAG,CAAC,OAAO,CAAC,gBAAgB,EAAE,IAAI,CAAC,CAAC;QAC/C,CAAC;KACJ;IACD,iBAAiB,EAAE;QACf,WAAW,EAAE,yCAAyC;QACtD,QAAQ,EAAE,CAAC,GAAW,EAAE,EAAE;YACtB,OAAO,GAAG,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;QACxC,CAAC;KACJ;CACJ,CAAA;AAED,SAAS,GAAG,CAAC,IAAY;IACrB,IAAI,CAAC,IAAI;QAAE,OAAO,IAAI,CAAC;IAEvB,KAAK,MAAM,GAAG,IAAI,YAAY,EAAE,CAAC;QAC7B,MAAM,WAAW,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC;QACtC,IAAI,WAAW;YAAE,IAAI,GAAG,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IACvD,CAAC;IAED,IAAI,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;IAEnB,OAAO,IAAI,CAAC;AAChB,CAAC;AAED,kBAAe,EAAE,GAAG,EAAE,CAAC"}
@@ -0,0 +1,15 @@
1
+ import { KeyboardLayout } from '../types/keyboard';
2
+ export interface TyposOptions {
3
+ types?: {
4
+ [key: string]: number;
5
+ };
6
+ keyboard?: {
7
+ layout: KeyboardLayout;
8
+ };
9
+ }
10
+ declare function make(text?: string, options?: TyposOptions): string;
11
+ declare const _default: {
12
+ make: typeof make;
13
+ };
14
+ export default _default;
15
+ //# sourceMappingURL=typos.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typos.d.ts","sourceRoot":"","sources":["../../src/core/typos.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAGnD,MAAM,WAAW,YAAY;IACzB,KAAK,CAAC,EAAE;QACJ,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;KACzB,CAAC;IACF,QAAQ,CAAC,EAAE;QACP,MAAM,EAAE,cAAc,CAAC;KAC1B,CAAA;CACJ;AA+FD,iBAAS,IAAI,CAAC,IAAI,GAAE,MAAW,EAAE,OAAO,GAAE,YAAiB,UA8C1D;;;;AAED,wBAAwB"}
@@ -0,0 +1,147 @@
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 path_1 = __importDefault(require("path"));
7
+ const fs_1 = __importDefault(require("fs"));
8
+ const randomBool_1 = __importDefault(require("../helpers/randomBool"));
9
+ const randomInt_1 = __importDefault(require("../helpers/randomInt"));
10
+ const randomLetter_1 = __importDefault(require("../helpers/randomLetter"));
11
+ const parseKeyboardMap = (layout) => {
12
+ const filePath = path_1.default.resolve(__dirname, `../data/keyboard/${layout}.json`);
13
+ console.log(filePath);
14
+ if (!fs_1.default.existsSync(filePath))
15
+ throw new Error(`Keyboard layout file "${layout}.json" not found.`);
16
+ const data = JSON.parse(fs_1.default.readFileSync(filePath, 'utf-8'));
17
+ if (!Array.isArray(data))
18
+ return {};
19
+ return data;
20
+ };
21
+ const keyboardMaps = {
22
+ qwerty: parseKeyboardMap('qwerty'),
23
+ azerty: parseKeyboardMap('azerty'),
24
+ };
25
+ const transformers = {
26
+ random: {
27
+ description: 'Replace the letter with a random letter',
28
+ callback: (letters, i) => {
29
+ letters[i] = (0, randomLetter_1.default)();
30
+ }
31
+ },
32
+ swap: {
33
+ description: 'Swap the letter with the next letter',
34
+ callback: (letters, i) => {
35
+ if (i < letters.length - 1) {
36
+ if (!letters[i + 1])
37
+ return;
38
+ if (!letters[i])
39
+ return;
40
+ const temp = letters[i];
41
+ letters[i] = letters[i + 1];
42
+ letters[i + 1] = temp;
43
+ }
44
+ }
45
+ },
46
+ map: {
47
+ description: 'Map the letter to a different letter based on the keyboard layout',
48
+ callback: (letters, i, layout) => {
49
+ if (!letters[i])
50
+ return;
51
+ const keyboardMap = keyboardMaps[layout];
52
+ const letterToFind = letters[i].toLowerCase();
53
+ if (!keyboardMap) {
54
+ console.warn(`Keyboard layout "${layout}" not found.`);
55
+ return;
56
+ }
57
+ if (!keyboardMap[letterToFind]) {
58
+ return;
59
+ }
60
+ const newLetter = keyboardMap[letterToFind][(0, randomInt_1.default)(0, keyboardMap[letterToFind].length - 1)];
61
+ if (!newLetter)
62
+ return;
63
+ // Preserve case
64
+ if (letters[i] === letters[i].toUpperCase()) {
65
+ letters[i] = newLetter.toUpperCase();
66
+ }
67
+ else {
68
+ letters[i] = newLetter;
69
+ }
70
+ }
71
+ },
72
+ drop: {
73
+ description: 'Remove the letter',
74
+ callback: (letters, i) => {
75
+ letters.splice(i, 1);
76
+ }
77
+ },
78
+ duplicate: {
79
+ description: 'Duplicate the letter',
80
+ callback: (letters, i) => {
81
+ if (!letters[i])
82
+ return;
83
+ letters.splice(i, 0, letters[i]);
84
+ }
85
+ }
86
+ };
87
+ const defaultKeyboardLayout = 'qwerty';
88
+ const defaultOptions = {
89
+ types: {
90
+ swap: 0.01, // percentage of letters to be swapped with the next letter
91
+ map: 0.02, // percentage of letters to be replaced with a letter from the keyboard map
92
+ duplicate: 0.02, // percentage of letters to be duplicated
93
+ drop: 0.02, // percentage of letters to be deleted
94
+ },
95
+ keyboard: {
96
+ layout: defaultKeyboardLayout, // keyboard layout to use
97
+ }
98
+ };
99
+ function make(text = '', options = {}) {
100
+ if (text.length === 0)
101
+ return text;
102
+ // Merge options with default options
103
+ options = {
104
+ ...defaultOptions,
105
+ ...options
106
+ };
107
+ // Types validation
108
+ if (options?.types) {
109
+ if (Object.keys(options.types).length === 0)
110
+ throw new Error('Types must not be empty');
111
+ for (const [type, percentage] of Object.entries(options.types)) {
112
+ if (!transformers[type])
113
+ throw new Error(`Type "${type}" is not a valid type`);
114
+ if (percentage < 0 || percentage > 1)
115
+ throw new Error(`Type "${type}" must be between 0 and 1`);
116
+ if (percentage === 0)
117
+ delete options.types[type]; // remove type if percentage is 0
118
+ }
119
+ }
120
+ // Keyboard validation
121
+ if (options?.keyboard) {
122
+ if (!options.keyboard.layout)
123
+ throw new Error('Keyboard layout must be specified');
124
+ if (!keyboardMaps[options.keyboard.layout])
125
+ throw new Error(`Keyboard layout "${options.keyboard.layout}" not found`);
126
+ }
127
+ let replaced = 0;
128
+ const letters = text.split('');
129
+ for (let i = 0; i < letters.length; i++) {
130
+ if (!options.types || Object.keys(options.types).length === 0)
131
+ break;
132
+ for (const [type, percentage] of Object.entries(options.types)) {
133
+ if ((0, randomBool_1.default)(percentage)) {
134
+ if (!transformers[type])
135
+ throw new Error(`Type "${type}" is not a valid type`);
136
+ transformers[type].callback(letters, i, options.keyboard?.layout ?? defaultKeyboardLayout);
137
+ replaced++;
138
+ }
139
+ }
140
+ if (replaced >= letters.length)
141
+ break;
142
+ }
143
+ text = letters.join('');
144
+ return text;
145
+ }
146
+ exports.default = {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AAO,CAAC,KAAK,CAAC,EAAE,CAAC;YAC7D,IAAI,IAAA,oBAAU,EAAC,UAAU,CAAC,EAAE,CAAC;gBACzB,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC;oBAAE,MAAM,IAAI,KAAK,CAAC,SAAS,IAAI,uBAAuB,CAAC,CAAC;gBAE/E,YAAY,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,EAAE,OAAO,CAAC,QAAQ,EAAE,MAAM,IAAI,qBAAqB,CAAC,CAAC;gBAC3F,QAAQ,EAAE,CAAC;YACf,CAAC;QACL,CAAC;QAED,IAAI,QAAQ,IAAI,OAAO,CAAC,MAAM;YAAE,MAAM;IAC1C,CAAC;IAED,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAExB,OAAO,IAAI,CAAC;AAChB,CAAC;AAED,kBAAe,EAAE,IAAI,EAAE,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * The Levenshtein distance is a measure of the similarity between two strings.
3
+ *
4
+ * Returns the Levenshtein distance between two strings.
5
+ */
6
+ declare function levenshtein(a: string, b: string): number;
7
+ export default levenshtein;
8
+ //# sourceMappingURL=levenshtein.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"levenshtein.d.ts","sourceRoot":"","sources":["../../src/helpers/levenshtein.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,iBAAS,WAAW,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAwCjD;AAED,eAAe,WAAW,CAAC"}
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ /**
4
+ * The Levenshtein distance is a measure of the similarity between two strings.
5
+ *
6
+ * Returns the Levenshtein distance between two strings.
7
+ */
8
+ function levenshtein(a, b) {
9
+ // Fast path
10
+ if (a === b)
11
+ return 0;
12
+ if (a.length === 0)
13
+ return b.length;
14
+ if (b.length === 0)
15
+ return a.length;
16
+ // Ensure a is the shorter string to save memory
17
+ if (a.length > b.length) {
18
+ [a, b] = [b, a];
19
+ }
20
+ const aLen = a.length;
21
+ const bLen = b.length;
22
+ let previous = new Array(aLen + 1).fill(0);
23
+ let current = new Array(aLen + 1).fill(0);
24
+ // Initialize first row
25
+ for (let i = 0; i <= aLen; i++) {
26
+ previous[i] = i;
27
+ }
28
+ for (let j = 1; j <= bLen; j++) {
29
+ current[0] = j;
30
+ for (let i = 1; i <= aLen; i++) {
31
+ const cost = a[i - 1] === b[j - 1] ? 0 : 1;
32
+ current[i] = Math.min(previous[i] + 1, // deletion
33
+ current[i - 1] + 1, // insertion
34
+ previous[i - 1] + cost // substitution
35
+ );
36
+ }
37
+ // Swap rows
38
+ [previous, current] = [current, previous];
39
+ }
40
+ return previous[aLen] ?? 0;
41
+ }
42
+ exports.default = levenshtein;
43
+ //# sourceMappingURL=levenshtein.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"levenshtein.js","sourceRoot":"","sources":["../../src/helpers/levenshtein.ts"],"names":[],"mappings":";;AAAA;;;;GAIG;AACH,SAAS,WAAW,CAAC,CAAS,EAAE,CAAS;IACrC,YAAY;IACZ,IAAI,CAAC,KAAK,CAAC;QAAE,OAAO,CAAC,CAAC;IACtB,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,CAAC,CAAC,MAAM,CAAC;IACpC,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,CAAC,CAAC,MAAM,CAAC;IAEpC,gDAAgD;IAChD,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC;QACtB,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACpB,CAAC;IAED,MAAM,IAAI,GAAG,CAAC,CAAC,MAAM,CAAC;IACtB,MAAM,IAAI,GAAG,CAAC,CAAC,MAAM,CAAC;IAEtB,I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,6 @@
1
+ /**
2
+ * Have a percentage chance of returning true or false.
3
+ */
4
+ declare function randomBool(percentage?: number): boolean;
5
+ export default randomBool;
6
+ //# sourceMappingURL=randomBool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"randomBool.d.ts","sourceRoot":"","sources":["../../src/helpers/randomBool.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,iBAAS,UAAU,CAAC,UAAU,SAAM,GAAG,OAAO,CAE7C;AAED,eAAe,UAAU,CAAC"}
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ /**
4
+ * Have a percentage chance of returning true or false.
5
+ */
6
+ function randomBool(percentage = 0.5) {
7
+ return Math.random() < percentage;
8
+ }
9
+ exports.default = randomBool;
10
+ //# sourceMappingURL=randomBool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"randomBool.js","sourceRoot":"","sources":["../../src/helpers/randomBool.ts"],"names":[],"mappings":";;AAAA;;GAEG;AACH,SAAS,UAAU,CAAC,UAAU,GAAG,GAAG;IAChC,OAAO,IAAI,CAAC,MAAM,EAAE,GAAG,UAAU,CAAC;AACtC,CAAC;AAED,kBAAe,UAAU,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Generate a random integer between min and max, inclusive.
3
+ */
4
+ declare function randomInt(min?: number, max?: number): number;
5
+ export default randomInt;
6
+ //# sourceMappingURL=randomInt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"randomInt.d.ts","sourceRoot":"","sources":["../../src/helpers/randomInt.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,iBAAS,SAAS,CAAC,GAAG,SAAI,EAAE,GAAG,SAAI,GAAG,MAAM,CAG3C;AAED,eAAe,SAAS,CAAC"}
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ /**
4
+ * Generate a random integer between min and max, inclusive.
5
+ */
6
+ function randomInt(min = 0, max = 1) {
7
+ if (min > max)
8
+ throw new Error('Min must be less than max');
9
+ return Math.floor(Math.random() * (max - min + 1)) + min;
10
+ }
11
+ exports.default = randomInt;
12
+ //# sourceMappingURL=randomInt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"randomInt.js","sourceRoot":"","sources":["../../src/helpers/randomInt.ts"],"names":[],"mappings":";;AAAA;;GAEG;AACH,SAAS,SAAS,CAAC,GAAG,GAAG,CAAC,EAAE,GAAG,GAAG,CAAC;IAC/B,IAAI,GAAG,GAAG,GAAG;QAAE,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;IAC5D,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC;AAC7D,CAAC;AAED,kBAAe,SAAS,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ *
3
+ * Returns a random letter from a-z.
4
+ */
5
+ declare function randomLetter(): string;
6
+ export default randomLetter;
7
+ //# sourceMappingURL=randomLetter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"randomLetter.d.ts","sourceRoot":"","sources":["../../src/helpers/randomLetter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,iBAAS,YAAY,IAAI,MAAM,CAE9B;AAED,eAAe,YAAY,CAAC"}
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ /**
4
+ *
5
+ * Returns a random letter from a-z.
6
+ */
7
+ function randomLetter() {
8
+ return String.fromCharCode(Math.floor(Math.random() * 26) + 97);
9
+ }
10
+ exports.default = randomLetter;
11
+ //# sourceMappingURL=randomLetter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"randomLetter.js","sourceRoot":"","sources":["../../src/helpers/randomLetter.ts"],"names":[],"mappings":";;AAAA;;;GAGG;AACH,SAAS,YAAY;IACjB,OAAO,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC;AACpE,CAAC;AAED,kBAAe,YAAY,CAAC"}
@@ -0,0 +1,13 @@
1
+ declare const humanizrr: {
2
+ typos: {
3
+ make: (text?: string, options?: import("./core/typos").TyposOptions) => string;
4
+ };
5
+ format: {
6
+ all: (text: string) => string;
7
+ };
8
+ markdown: {
9
+ all: (text: string) => string;
10
+ };
11
+ };
12
+ export default humanizrr;
13
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,QAAA,MAAM,SAAS;;;;;;;;;;CAId,CAAC;AAEF,eAAe,SAAS,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,15 @@
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 typos_1 = __importDefault(require("./core/typos"));
7
+ const format_1 = __importDefault(require("./core/format"));
8
+ const markdown_1 = __importDefault(require("./core/markdown"));
9
+ const humanizrr = {
10
+ typos: typos_1.default,
11
+ format: format_1.default,
12
+ markdown: markdown_1.default,
13
+ };
14
+ exports.default = humanizrr;
15
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;AAAA,yDAAiC;AACjC,2DAAmC;AACnC,+DAAuC;AAEvC,MAAM,SAAS,GAAG;IACd,KAAK,EAAL,eAAK;IACL,MAAM,EAAN,gBAAM;IACN,QAAQ,EAAR,kBAAQ;CACX,CAAC;AAEF,kBAAe,SAAS,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=playground.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"playground.d.ts","sourceRoot":"","sources":["../src/playground.ts"],"names":[],"mappings":""}
@@ -0,0 +1,21 @@
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 index_1 = __importDefault(require("./index"));
7
+ let text = "";
8
+ console.log("======================================================");
9
+ for (let i = 0; i < 10; i++) {
10
+ text = "Live is like a box of chocolates. You never know what you're gonna get.";
11
+ console.log(index_1.default.typos.make(text, { types: { swap: 0, map: 0.01, duplicate: 0, drop: 0 } }));
12
+ }
13
+ console.log("======================================================");
14
+ text = "Hey 😊! This is a test string with emojis 🚀🔥 and other characters 🎉.";
15
+ console.log(text);
16
+ console.log(index_1.default.format.all(text));
17
+ console.log("======================================================");
18
+ text = "Here’s an example — with “quotes” and… special œ characters!";
19
+ console.log(text);
20
+ console.log(index_1.default.format.all(text));
21
+ //# sourceMappingURL=playground.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"playground.js","sourceRoot":"","sources":["../src/playground.ts"],"names":[],"mappings":";;;;;AAAA,oDAAgC;AAEhC,IAAI,IAAI,GAAG,EAAE,CAAC;AAEd,OAAO,CAAC,GAAG,CAAC,wDAAwD,CAAC,CAAC;AAEtE,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC;IAC1B,IAAI,GAAG,yEAAyE,CAAC;IACjF,OAAO,CAAC,GAAG,CAAC,eAAS,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;AACtG,CAAC;AACD,OAAO,CAAC,GAAG,CAAC,wDAAwD,CAAC,CAAC;AAEtE,IAAI,GAAG,yEAAyE,CAAC;AACjF,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AAClB,OAAO,CAAC,GAAG,CAAC,eAAS,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;AAExC,OAAO,CAAC,GAAG,CAAC,wDAAwD,CAAC,CAAC;AAEtE,IAAI,GAAG,8DAA8D,CAAC;AACtE,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AAClB,OAAO,CAAC,GAAG,CAAC,eAAS,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC"}
@@ -0,0 +1,6 @@
1
+ export type KeyboardLayout = 'azerty' | 'qwerty';
2
+ export type KeyboardKey = 'a' | 'b' | 'c' | 'd' | 'e' | 'f' | 'g' | 'h' | 'i' | 'j' | 'k' | 'l' | 'm' | 'n' | 'o' | 'p' | 'q' | 'r' | 's' | 't' | 'u' | 'v' | 'w' | 'x' | 'y' | 'z';
3
+ export type KeyboardMap = {
4
+ [key in KeyboardKey]?: string[];
5
+ };
6
+ //# sourceMappingURL=keyboard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keyboard.d.ts","sourceRoot":"","sources":["../../src/types/keyboard.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAEjD,MAAM,MAAM,WAAW,GACnB,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GACzD,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GACzD,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;AAEtC,MAAM,MAAM,WAAW,GAAG;KACrB,GAAG,IAAI,WAAW,CAAC,CAAC,EAAE,MAAM,EAAE;CAClC,CAAC"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=keyboard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keyboard.js","sourceRoot":"","sources":["../../src/types/keyboard.ts"],"names":[],"mappings":""}
@@ -0,0 +1,10 @@
1
+ type Callback<T extends any[], R> = (...args: T) => R;
2
+ export interface Transformer {
3
+ description: string;
4
+ callback: Callback<any[], any>;
5
+ }
6
+ export interface TransformerCollection {
7
+ [key: string]: Transformer;
8
+ }
9
+ export {};
10
+ //# sourceMappingURL=transformer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transformer.d.ts","sourceRoot":"","sources":["../../src/types/transformer.ts"],"names":[],"mappings":"AACA,KAAK,QAAQ,CAAC,CAAC,SAAS,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC;AAGtD,MAAM,WAAW,WAAW;IACxB,WAAW,EAAE,MAAM,CAAC;IAEpB,QAAQ,EAAE,QAAQ,CAAC,GAAG,EAAE,EAAE,GAAG,CAAC,CAAC;CAClC;AAED,MAAM,WAAW,qBAAqB;IAClC,CAAC,GAAG,EAAE,MAAM,GAAG,WAAW,CAAC;CAC9B"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=transformer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transformer.js","sourceRoot":"","sources":["../../src/types/transformer.ts"],"names":[],"mappings":""}
@@ -0,0 +1,18 @@
1
+ import js from "@eslint/js";
2
+ import globals from "globals";
3
+ import tseslint from "typescript-eslint";
4
+ import { defineConfig } from "eslint/config";
5
+
6
+ export default defineConfig([
7
+ {
8
+ files: ["**/*.{js,mjs,cjs,ts,mts,cts}"],
9
+ plugins: {
10
+ js
11
+ },
12
+ extends: ["js/recommended"],
13
+ languageOptions: {
14
+ globals: globals.browser
15
+ }
16
+ },
17
+ tseslint.configs.recommended, // Use TypeScript ESLint recommended rules
18
+ ]);
package/jest.config.js ADDED
@@ -0,0 +1,9 @@
1
+ /** @type {import('ts-jest').JestConfigWithTsJest} */
2
+
3
+ export const preset = 'ts-jest';
4
+
5
+ export const testEnvironment = 'node';
6
+
7
+ export const testMatch = ['**/__tests__/**/*.test.ts', '**/?(*.)+(spec|test).ts'];
8
+
9
+ export const moduleFileExtensions = ['ts', 'js', 'json', 'node'];