es-toolkit 1.16.0-dev.489 → 1.16.0-dev.491

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.
@@ -97,6 +97,7 @@ export { capitalize } from '../string/capitalize.mjs';
97
97
  export { pascalCase } from '../string/pascalCase.mjs';
98
98
  export { upperFirst } from '../string/upperFirst.mjs';
99
99
  export { lowerFirst } from '../string/lowerFirst.mjs';
100
+ export { deburr } from '../string/deburr.mjs';
100
101
  export { chunk } from './array/chunk.mjs';
101
102
  export { concat } from './array/concat.mjs';
102
103
  export { difference } from './array/difference.mjs';
@@ -97,6 +97,7 @@ export { capitalize } from '../string/capitalize.js';
97
97
  export { pascalCase } from '../string/pascalCase.js';
98
98
  export { upperFirst } from '../string/upperFirst.js';
99
99
  export { lowerFirst } from '../string/lowerFirst.js';
100
+ export { deburr } from '../string/deburr.js';
100
101
  export { chunk } from './array/chunk.js';
101
102
  export { concat } from './array/concat.js';
102
103
  export { difference } from './array/difference.js';
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
 
5
- const initial = require('../_chunk/initial-BEpVqm.js');
5
+ const initial = require('../_chunk/initial-CSA-KP.js');
6
6
  const promise_index = require('../_chunk/index-CoqN5B.js');
7
7
  const function_index = require('../function/index.js');
8
8
  const math_index = require('../math/index.js');
@@ -914,6 +914,7 @@ exports.isUndefined = isFunction.isUndefined;
914
914
  exports.isPrimitive = isTypedArray$1.isPrimitive;
915
915
  exports.camelCase = string_index.camelCase;
916
916
  exports.capitalize = string_index.capitalize;
917
+ exports.deburr = string_index.deburr;
917
918
  exports.kebabCase = string_index.kebabCase;
918
919
  exports.lowerCase = string_index.lowerCase;
919
920
  exports.lowerFirst = string_index.lowerFirst;
@@ -98,6 +98,7 @@ export { capitalize } from '../string/capitalize.mjs';
98
98
  export { pascalCase } from '../string/pascalCase.mjs';
99
99
  export { upperFirst } from '../string/upperFirst.mjs';
100
100
  export { lowerFirst } from '../string/lowerFirst.mjs';
101
+ export { deburr } from '../string/deburr.mjs';
101
102
  export { chunk } from './array/chunk.mjs';
102
103
  export { concat } from './array/concat.mjs';
103
104
  export { difference } from './array/difference.mjs';
package/dist/index.d.mts CHANGED
@@ -115,3 +115,4 @@ export { capitalize } from './string/capitalize.mjs';
115
115
  export { pascalCase } from './string/pascalCase.mjs';
116
116
  export { upperFirst } from './string/upperFirst.mjs';
117
117
  export { lowerFirst } from './string/lowerFirst.mjs';
118
+ export { deburr } from './string/deburr.mjs';
package/dist/index.d.ts CHANGED
@@ -115,3 +115,4 @@ export { capitalize } from './string/capitalize.js';
115
115
  export { pascalCase } from './string/pascalCase.js';
116
116
  export { upperFirst } from './string/upperFirst.js';
117
117
  export { lowerFirst } from './string/lowerFirst.js';
118
+ export { deburr } from './string/deburr.js';
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
 
5
- const initial = require('./_chunk/initial-BEpVqm.js');
5
+ const initial = require('./_chunk/initial-CSA-KP.js');
6
6
  const array_index = require('./array/index.js');
7
7
  const promise_index = require('./_chunk/index-CoqN5B.js');
8
8
  const function_index = require('./function/index.js');
@@ -127,6 +127,7 @@ exports.isString = predicate_index.isString;
127
127
  exports.isSymbol = predicate_index.isSymbol;
128
128
  exports.camelCase = string_index.camelCase;
129
129
  exports.capitalize = string_index.capitalize;
130
+ exports.deburr = string_index.deburr;
130
131
  exports.kebabCase = string_index.kebabCase;
131
132
  exports.lowerCase = string_index.lowerCase;
132
133
  exports.lowerFirst = string_index.lowerFirst;
package/dist/index.mjs CHANGED
@@ -115,3 +115,4 @@ export { capitalize } from './string/capitalize.mjs';
115
115
  export { pascalCase } from './string/pascalCase.mjs';
116
116
  export { upperFirst } from './string/upperFirst.mjs';
117
117
  export { lowerFirst } from './string/lowerFirst.mjs';
118
+ export { deburr } from './string/deburr.mjs';
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Deburrs `str` by converting [Latin-1 Supplement](<https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table>) and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A) letters to basic Latin letters and removing [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
3
+ *
4
+ * @param {string} str The string to deburr.
5
+ * @returns {string} Returns the deburred string.
6
+ */
7
+ declare function deburr(str: string): string;
8
+
9
+ export { deburr };
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Deburrs `str` by converting [Latin-1 Supplement](<https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table>) and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A) letters to basic Latin letters and removing [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
3
+ *
4
+ * @param {string} str The string to deburr.
5
+ * @returns {string} Returns the deburred string.
6
+ */
7
+ declare function deburr(str: string): string;
8
+
9
+ export { deburr };
@@ -0,0 +1,45 @@
1
+ const deburrMap = {
2
+ Æ: 'Ae',
3
+ Ð: 'D',
4
+ Ø: 'O',
5
+ Þ: 'Th',
6
+ ß: 'ss',
7
+ æ: 'ae',
8
+ ð: 'd',
9
+ ø: 'o',
10
+ þ: 'th',
11
+ Đ: 'D',
12
+ đ: 'd',
13
+ Ħ: 'H',
14
+ ħ: 'h',
15
+ ı: 'i',
16
+ IJ: 'IJ',
17
+ ij: 'ij',
18
+ ĸ: 'k',
19
+ Ŀ: 'L',
20
+ ŀ: 'l',
21
+ Ł: 'L',
22
+ ł: 'l',
23
+ ʼn: "'n",
24
+ Ŋ: 'N',
25
+ ŋ: 'n',
26
+ Œ: 'Oe',
27
+ œ: 'oe',
28
+ Ŧ: 'T',
29
+ ŧ: 't',
30
+ ſ: 's',
31
+ };
32
+ function deburr(str) {
33
+ str = str.normalize('NFD');
34
+ const result = [];
35
+ for (let i = 0; i < str.length; i++) {
36
+ const char = str[i];
37
+ if ((char >= '\u0300' && char <= '\u036f') || (char >= '\ufe20' && char <= '\ufe23')) {
38
+ continue;
39
+ }
40
+ result.push(deburrMap[char] ?? char);
41
+ }
42
+ return result.join('');
43
+ }
44
+
45
+ export { deburr };
@@ -7,3 +7,4 @@ export { capitalize } from './capitalize.mjs';
7
7
  export { pascalCase } from './pascalCase.mjs';
8
8
  export { upperFirst } from './upperFirst.mjs';
9
9
  export { lowerFirst } from './lowerFirst.mjs';
10
+ export { deburr } from './deburr.mjs';
@@ -7,3 +7,4 @@ export { capitalize } from './capitalize.js';
7
7
  export { pascalCase } from './pascalCase.js';
8
8
  export { upperFirst } from './upperFirst.js';
9
9
  export { lowerFirst } from './lowerFirst.js';
10
+ export { deburr } from './deburr.js';
@@ -65,8 +65,53 @@ const lowerFirst = (str) => {
65
65
  return str.substring(0, 1).toLowerCase() + str.substring(1);
66
66
  };
67
67
 
68
+ const deburrMap = {
69
+ Æ: 'Ae',
70
+ Ð: 'D',
71
+ Ø: 'O',
72
+ Þ: 'Th',
73
+ ß: 'ss',
74
+ æ: 'ae',
75
+ ð: 'd',
76
+ ø: 'o',
77
+ þ: 'th',
78
+ Đ: 'D',
79
+ đ: 'd',
80
+ Ħ: 'H',
81
+ ħ: 'h',
82
+ ı: 'i',
83
+ IJ: 'IJ',
84
+ ij: 'ij',
85
+ ĸ: 'k',
86
+ Ŀ: 'L',
87
+ ŀ: 'l',
88
+ Ł: 'L',
89
+ ł: 'l',
90
+ ʼn: "'n",
91
+ Ŋ: 'N',
92
+ ŋ: 'n',
93
+ Œ: 'Oe',
94
+ œ: 'oe',
95
+ Ŧ: 'T',
96
+ ŧ: 't',
97
+ ſ: 's',
98
+ };
99
+ function deburr(str) {
100
+ str = str.normalize('NFD');
101
+ const result = [];
102
+ for (let i = 0; i < str.length; i++) {
103
+ const char = str[i];
104
+ if ((char >= '\u0300' && char <= '\u036f') || (char >= '\ufe20' && char <= '\ufe23')) {
105
+ continue;
106
+ }
107
+ result.push(deburrMap[char] ?? char);
108
+ }
109
+ return result.join('');
110
+ }
111
+
68
112
  exports.camelCase = camelCase;
69
113
  exports.capitalize = capitalize;
114
+ exports.deburr = deburr;
70
115
  exports.kebabCase = kebabCase;
71
116
  exports.lowerCase = lowerCase;
72
117
  exports.lowerFirst = lowerFirst;
@@ -7,3 +7,4 @@ export { capitalize } from './capitalize.mjs';
7
7
  export { pascalCase } from './pascalCase.mjs';
8
8
  export { upperFirst } from './upperFirst.mjs';
9
9
  export { lowerFirst } from './lowerFirst.mjs';
10
+ export { deburr } from './deburr.mjs';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "es-toolkit",
3
3
  "description": "A state-of-the-art, high-performance JavaScript utility library with a small bundle size and strong type annotations.",
4
- "version": "1.16.0-dev.489+367fc870",
4
+ "version": "1.16.0-dev.491+58d1cb2f",
5
5
  "homepage": "https://es-toolkit.slash.page",
6
6
  "bugs": "https://github.com/toss/es-toolkit/issues",
7
7
  "repository": {