@senhainfo/shared-utils 1.5.21 → 1.6.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.
- package/lib/format-text.d.ts +4 -2
- package/lib/format-text.d.ts.map +1 -1
- package/lib/format-text.js +150 -49
- package/lib/format-text.js.map +1 -1
- package/package.json +2 -2
package/lib/format-text.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
type CapitalizeModeType =
|
|
1
|
+
type CapitalizeModeType = 'words' | 'first-letter';
|
|
2
2
|
type NormalizeOptions = {
|
|
3
3
|
/**
|
|
4
|
-
* Removes diacritics from the text.
|
|
4
|
+
* Removes diacritics from the text (e.g. "João" -> "Joao").
|
|
5
5
|
* Set this to `false` to preserve diacritics.
|
|
6
6
|
* @default true
|
|
7
7
|
*/
|
|
@@ -20,6 +20,8 @@ type NormalizeOptions = {
|
|
|
20
20
|
trim?: boolean;
|
|
21
21
|
/**
|
|
22
22
|
* Set the length of the text to which it should be normalized.
|
|
23
|
+
* Counted in Unicode code points (not UTF-16 units), so astral
|
|
24
|
+
* characters (e.g. rare CJK ideographs) aren't cut in half.
|
|
23
25
|
*/
|
|
24
26
|
maxLength?: number;
|
|
25
27
|
};
|
package/lib/format-text.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format-text.d.ts","sourceRoot":"","sources":["../src/format-text.ts"],"names":[],"mappings":"AAEA,KAAK,kBAAkB,GAAG,OAAO,GAAG,cAAc,CAAC;AAEnD,KAAK,gBAAgB,GAAG;IACtB;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAE3B;;;;OAIG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IAEvB;;;;OAIG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IAEf
|
|
1
|
+
{"version":3,"file":"format-text.d.ts","sourceRoot":"","sources":["../src/format-text.ts"],"names":[],"mappings":"AAEA,KAAK,kBAAkB,GAAG,OAAO,GAAG,cAAc,CAAC;AAEnD,KAAK,gBAAgB,GAAG;IACtB;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAE3B;;;;OAIG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IAEvB;;;;OAIG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IAEf;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAsEF,qBAAa,UAAU;IACrB;;;;;;;OAOG;IACI,SAAS,CACd,IAAI,CAAC,EAAE,MAAM,EACb,EAAE,gBAAuB,EAAE,YAAmB,EAAE,IAAW,EAAE,SAAS,EAAE,GAAE,gBAAqB,GAC9F,MAAM;IAgET;;;;;;OAMG;IACI,UAAU,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,IAAI,GAAE,kBAA4B,GAAG,MAAM;IAmH5E;;;;;OAKG;IACI,qBAAqB,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM;IAQnD;;;;;OAKG;IACI,aAAa,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM;IAQ3C;;;;;OAKG;IACI,cAAc,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM;CAkD5C"}
|
package/lib/format-text.js
CHANGED
|
@@ -2,6 +2,61 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.FormatText = void 0;
|
|
4
4
|
const confusables_1 = require("confusables");
|
|
5
|
+
/**
|
|
6
|
+
* Checks if a single character is a "base Latin letter + diacritic",
|
|
7
|
+
* e.g. "é", "ã", "ç", "ü" — as opposed to a character from another
|
|
8
|
+
* script that merely *looks* like a Latin letter (the actual case
|
|
9
|
+
* `confusables` is meant to catch, e.g. Cyrillic "а" vs Latin "a").
|
|
10
|
+
*
|
|
11
|
+
* Works by decomposing (NFD): a legitimate accented Latin letter
|
|
12
|
+
* decomposes into more than one code point, where the first is a
|
|
13
|
+
* plain ASCII letter. This works for any language (pt, fr, de, etc.)
|
|
14
|
+
* without needing a hardcoded list of Unicode ranges.
|
|
15
|
+
*/
|
|
16
|
+
function isDiacriticLatinChar(char) {
|
|
17
|
+
const decomposed = char.normalize('NFD');
|
|
18
|
+
return decomposed.length > 1 && /^[A-Za-z]/.test(decomposed);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Matches a full emoji *sequence* as a single unit, not just one code
|
|
22
|
+
* point — this matters because most emojis are made of several code
|
|
23
|
+
* points glued together, e.g.:
|
|
24
|
+
* - keycaps: digit + optional variation selector + U+20E3 ("1️⃣")
|
|
25
|
+
* - ZWJ sequences: pictograph + U+200D + pictograph (...) ("👨👩👧👦")
|
|
26
|
+
* - flags: two regional-indicator letters ("🇧🇷")
|
|
27
|
+
* If we protected code point by code point, `confusables` would still
|
|
28
|
+
* see the leftover joiners/selectors around the (now placeholder)
|
|
29
|
+
* base characters and normalize the sequence anyway.
|
|
30
|
+
*/
|
|
31
|
+
const EMOJI_SEQUENCE_RE = /(\p{Extended_Pictographic}\uFE0F?(\u200D\p{Extended_Pictographic}\uFE0F?)*|[0-9#*]\uFE0F?\u20E3|\p{Regional_Indicator}{2})/gu;
|
|
32
|
+
/**
|
|
33
|
+
* Temporarily swaps out characters/sequences we want `confusables` to
|
|
34
|
+
* leave alone for placeholder tokens (Private Use Area code points,
|
|
35
|
+
* which never occur in real text and aren't in confusables.txt), runs
|
|
36
|
+
* `confusables`' anti-spoofing pass on what's left, then restores the
|
|
37
|
+
* originals. Real homoglyphs (Cyrillic lookalikes, etc.) still get
|
|
38
|
+
* normalized either way — only the explicitly protected content survives.
|
|
39
|
+
*/
|
|
40
|
+
function withProtectedConfusables(text, { protectDiacritics, protectEmojis }, run) {
|
|
41
|
+
const preserved = [];
|
|
42
|
+
const protect = (match) => {
|
|
43
|
+
preserved.push(match);
|
|
44
|
+
return `\uE000${preserved.length - 1}\uE001`;
|
|
45
|
+
};
|
|
46
|
+
let protectedText = text;
|
|
47
|
+
if (protectEmojis) {
|
|
48
|
+
// Sequences first, and as whole units, so a later char-by-char
|
|
49
|
+
// pass (diacritics) can't split one apart.
|
|
50
|
+
protectedText = protectedText.replace(EMOJI_SEQUENCE_RE, protect);
|
|
51
|
+
}
|
|
52
|
+
if (protectDiacritics) {
|
|
53
|
+
protectedText = Array.from(protectedText)
|
|
54
|
+
.map((char) => (isDiacriticLatinChar(char) ? protect(char) : char))
|
|
55
|
+
.join('');
|
|
56
|
+
}
|
|
57
|
+
const result = run(protectedText);
|
|
58
|
+
return result.replace(/\uE000(\d+)\uE001/g, (_, index) => preserved[Number(index)]);
|
|
59
|
+
}
|
|
5
60
|
class FormatText {
|
|
6
61
|
/**
|
|
7
62
|
* Normalize a string by replacing special characters with their standard equivalents
|
|
@@ -13,22 +68,59 @@ class FormatText {
|
|
|
13
68
|
*/
|
|
14
69
|
normalize(text, { removeDiacritics = true, removeEmojis = true, trim = true, maxLength } = {}) {
|
|
15
70
|
if (!text) {
|
|
16
|
-
return
|
|
71
|
+
return '';
|
|
17
72
|
}
|
|
18
|
-
|
|
73
|
+
// Invisible/control characters: always stripped, regardless of options.
|
|
74
|
+
// These never have a legitimate reason to reach a database field.
|
|
75
|
+
text = text.replace(/[\u00A0\u202F\u200B-\u200F\u2028\u2029\u2066-\u2069]/g, '');
|
|
19
76
|
if (removeDiacritics) {
|
|
20
|
-
|
|
77
|
+
// NFD decomposes accented letters into base letter + combining mark,
|
|
78
|
+
// e.g. "é" -> "e" + U+0301. We only do this decomposition when we're
|
|
79
|
+
// actually going to strip the marks — no reason to alter the string's
|
|
80
|
+
// internal representation otherwise.
|
|
81
|
+
text = text.normalize('NFD').replace(/[\u0300-\u036f]/g, ''); // Diacritics
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
// Always keep the string in composed form (NFC) when diacritics are
|
|
85
|
+
// preserved. Without this, two visually-identical strings coming from
|
|
86
|
+
// different sources (e.g. one NFC from a DB, one NFD from a browser)
|
|
87
|
+
// would fail a `===` comparison and have different `.length`.
|
|
88
|
+
text = text.normalize('NFC');
|
|
21
89
|
}
|
|
22
90
|
if (removeEmojis) {
|
|
23
|
-
|
|
91
|
+
// NOTE: intentionally NOT using \p{Emoji} here. That property also
|
|
92
|
+
// matches plain digits 0-9, '#', and '*', because they're part of
|
|
93
|
+
// "keycap" emoji sequences (1️⃣, #️⃣). Using \p{Emoji} alone strips
|
|
94
|
+
// digits from unrelated text. \p{Extended_Pictographic} covers the
|
|
95
|
+
// vast majority of real emojis (faces, objects, symbols, flags)
|
|
96
|
+
// without touching digits.
|
|
97
|
+
text = text.replace(/\p{Extended_Pictographic}/gu, ''); // Emojis
|
|
24
98
|
}
|
|
25
99
|
if (trim) {
|
|
26
100
|
text = text.trim(); // Trim
|
|
27
101
|
}
|
|
28
|
-
if (maxLength !== undefined
|
|
29
|
-
text
|
|
102
|
+
if (maxLength !== undefined) {
|
|
103
|
+
// Use Array.from (or [...text]) instead of .substring/.slice so we
|
|
104
|
+
// count Unicode code points, not UTF-16 code units. .substring() can
|
|
105
|
+
// split a surrogate pair in half (e.g. certain emoji or rare CJK
|
|
106
|
+
// characters), producing an invalid/corrupted trailing character.
|
|
107
|
+
const chars = Array.from(text);
|
|
108
|
+
if (chars.length > maxLength) {
|
|
109
|
+
text = chars.slice(0, maxLength).join('');
|
|
110
|
+
}
|
|
30
111
|
}
|
|
31
|
-
|
|
112
|
+
// `confusables` normalizes homoglyphs/lookalike characters for
|
|
113
|
+
// anti-spoofing purposes (e.g. Cyrillic "а" -> Latin "a"). Its
|
|
114
|
+
// confusables.txt dataset also treats accented Latin letters (é, ã,
|
|
115
|
+
// ç...) AND emoji sequences like keycaps (1️⃣) as "confusable" with
|
|
116
|
+
// their plain-character equivalent, so calling it unconditionally
|
|
117
|
+
// strips them even when removeDiacritics/removeEmojis are false.
|
|
118
|
+
// Shield whatever the caller asked to preserve before running it.
|
|
119
|
+
const protectDiacritics = !removeDiacritics;
|
|
120
|
+
const protectEmojis = !removeEmojis;
|
|
121
|
+
return protectDiacritics || protectEmojis
|
|
122
|
+
? withProtectedConfusables(text, { protectDiacritics, protectEmojis }, confusables_1.remove)
|
|
123
|
+
: (0, confusables_1.remove)(text);
|
|
32
124
|
}
|
|
33
125
|
/**
|
|
34
126
|
* Capitalize a string
|
|
@@ -37,32 +129,41 @@ class FormatText {
|
|
|
37
129
|
* @param {CapitalizeModeType} [mode] - The mode to capitalize the string
|
|
38
130
|
* @returns {string} The capitalized string
|
|
39
131
|
*/
|
|
40
|
-
capitalize(text, mode =
|
|
132
|
+
capitalize(text, mode = 'words') {
|
|
41
133
|
if (!text) {
|
|
42
|
-
return
|
|
134
|
+
return '';
|
|
43
135
|
}
|
|
44
|
-
if (mode ===
|
|
136
|
+
if (mode === 'first-letter') {
|
|
45
137
|
return text.charAt(0).toUpperCase() + text.slice(1).toLowerCase();
|
|
46
138
|
}
|
|
47
|
-
const words = text.split(
|
|
139
|
+
const words = text.split(' ');
|
|
48
140
|
const capitalizedWords = words.map((word, index) => {
|
|
49
|
-
// Should capitalize when first word
|
|
50
|
-
if (word.match(/^(?:de|da|das|do|dos|del|by|à|e|o|ou|y)$/i)) {
|
|
51
|
-
if (index
|
|
52
|
-
return word.toUpperCase();
|
|
53
|
-
}
|
|
54
|
-
return word.toLowerCase();
|
|
55
|
-
}
|
|
56
|
-
// Shouldn't capitalize when first word
|
|
57
|
-
if (word.match(/^(?:em|por|para)$/i)) {
|
|
58
|
-
if (!(index === 0)) {
|
|
141
|
+
// Should capitalize when first word, but not when in the middle
|
|
142
|
+
if (word.match(/^(?:em|por|para|de|da|das|do|dos|del|by|à|e|o|ou|y)$/i)) {
|
|
143
|
+
if (index !== 0) {
|
|
59
144
|
return word.toLowerCase();
|
|
60
145
|
}
|
|
61
146
|
}
|
|
62
|
-
//
|
|
63
|
-
if (word.match(/^(?:pj|ga7|lg|mt|gp|gbl|wl|hkd|nm|amd|crm|gg|rca|tti|mg|sc|gl)$/i)) {
|
|
147
|
+
// Custom validations
|
|
148
|
+
if (word.match(/^(?:pj|ga7|lg|mt|gp|gbl|wl|hkd|nm|amd|crm|gg|rca|tti|mg|sc|gl|jbf)$/i)) {
|
|
149
|
+
return word.toUpperCase();
|
|
150
|
+
}
|
|
151
|
+
// Matches fiscal words
|
|
152
|
+
if (word.match(/^(?:efd|ncm|cfop)$/i)) {
|
|
64
153
|
return word.toUpperCase();
|
|
65
154
|
}
|
|
155
|
+
if (word.match(/^(?:dfe)$/i)) {
|
|
156
|
+
return 'DFe';
|
|
157
|
+
}
|
|
158
|
+
if (word.match(/^(?:df-e)$/i)) {
|
|
159
|
+
return 'DF-e';
|
|
160
|
+
}
|
|
161
|
+
if (word.match(/^(?:nfe)$/i)) {
|
|
162
|
+
return 'NFe';
|
|
163
|
+
}
|
|
164
|
+
if (word.match(/^(?:nf-e)$/i)) {
|
|
165
|
+
return 'NF-e';
|
|
166
|
+
}
|
|
66
167
|
// Matches special cases
|
|
67
168
|
if (word.match(/^(?:cde)$/i)) {
|
|
68
169
|
return word.toUpperCase();
|
|
@@ -77,10 +178,10 @@ class FormatText {
|
|
|
77
178
|
}
|
|
78
179
|
// Matches patterns like "`A"
|
|
79
180
|
if (word.match(/`[A-Z]/)) {
|
|
80
|
-
const [first, second] = word.split(
|
|
181
|
+
const [first, second] = word.split('`');
|
|
81
182
|
return (first.charAt(0).toUpperCase() +
|
|
82
183
|
first.slice(1).toLowerCase() +
|
|
83
|
-
|
|
184
|
+
'`' +
|
|
84
185
|
second.charAt(0).toUpperCase() +
|
|
85
186
|
second.slice(1).toLowerCase());
|
|
86
187
|
}
|
|
@@ -95,19 +196,19 @@ class FormatText {
|
|
|
95
196
|
}
|
|
96
197
|
// Matches patterns like "/A" (word after slash, e.g. "A/B")
|
|
97
198
|
if (word.match(/\/[A-Z]/)) {
|
|
98
|
-
const [first, second] = word.split(
|
|
199
|
+
const [first, second] = word.split('/');
|
|
99
200
|
return (first.charAt(0).toUpperCase() +
|
|
100
201
|
first.slice(1).toLowerCase() +
|
|
101
|
-
|
|
202
|
+
'/' +
|
|
102
203
|
second.charAt(0).toUpperCase() +
|
|
103
204
|
second.slice(1).toLowerCase());
|
|
104
205
|
}
|
|
105
206
|
// Matches patterns like "A-B"
|
|
106
207
|
if (word.match(/[A-Z]-[A-Z]/)) {
|
|
107
|
-
const [first, second] = word.split(
|
|
208
|
+
const [first, second] = word.split('-');
|
|
108
209
|
return (first.charAt(0).toUpperCase() +
|
|
109
210
|
first.slice(1).toLowerCase() +
|
|
110
|
-
|
|
211
|
+
'-' +
|
|
111
212
|
second.charAt(0).toUpperCase() +
|
|
112
213
|
second.slice(1).toLowerCase());
|
|
113
214
|
}
|
|
@@ -117,7 +218,7 @@ class FormatText {
|
|
|
117
218
|
}
|
|
118
219
|
return word.charAt(0).toUpperCase() + word.slice(1).toLowerCase();
|
|
119
220
|
});
|
|
120
|
-
return capitalizedWords.join(
|
|
221
|
+
return capitalizedWords.join(' ').replace('`', "'");
|
|
121
222
|
}
|
|
122
223
|
/**
|
|
123
224
|
* Remove non-alphanumeric characters from a string
|
|
@@ -127,9 +228,9 @@ class FormatText {
|
|
|
127
228
|
*/
|
|
128
229
|
removeNonAlphanumeric(text) {
|
|
129
230
|
if (!text) {
|
|
130
|
-
return
|
|
231
|
+
return '';
|
|
131
232
|
}
|
|
132
|
-
return text.replace(/[^a-zA-Z0-9]/g,
|
|
233
|
+
return text.replace(/[^a-zA-Z0-9]/g, '');
|
|
133
234
|
}
|
|
134
235
|
/**
|
|
135
236
|
* Remove letters from a string
|
|
@@ -139,9 +240,9 @@ class FormatText {
|
|
|
139
240
|
*/
|
|
140
241
|
removeLetters(text) {
|
|
141
242
|
if (!text) {
|
|
142
|
-
return
|
|
243
|
+
return '';
|
|
143
244
|
}
|
|
144
|
-
return text.replace(/[a-zA-Z]/g,
|
|
245
|
+
return text.replace(/[a-zA-Z]/g, '');
|
|
145
246
|
}
|
|
146
247
|
/**
|
|
147
248
|
* Parse RTF string to plain text
|
|
@@ -151,39 +252,39 @@ class FormatText {
|
|
|
151
252
|
*/
|
|
152
253
|
rtfToPlainText(rtf) {
|
|
153
254
|
if (!rtf) {
|
|
154
|
-
return
|
|
255
|
+
return '';
|
|
155
256
|
}
|
|
156
257
|
let text = rtf;
|
|
157
258
|
// Remove blocos RTF com chaves aninhadas (como fonttbl)
|
|
158
259
|
while (text.match(/\{\\fonttbl[^{}]*(\{[^{}]*\}[^{}]*)*\}/g)) {
|
|
159
|
-
text = text.replace(/\{\\fonttbl[^{}]*(\{[^{}]*\}[^{}]*)*\}/g,
|
|
260
|
+
text = text.replace(/\{\\fonttbl[^{}]*(\{[^{}]*\}[^{}]*)*\}/g, '');
|
|
160
261
|
}
|
|
161
262
|
// Remove outros blocos de cabeçalho
|
|
162
|
-
text = text.replace(/\{\\colortbl[^}]*\}/g,
|
|
163
|
-
text = text.replace(/\{\\stylesheet[^}]*\}/g,
|
|
164
|
-
text = text.replace(/\{\\info[^}]*\}/g,
|
|
165
|
-
text = text.replace(/\{\\(\*)?\\[a-z]+[^}]*\}/g,
|
|
263
|
+
text = text.replace(/\{\\colortbl[^}]*\}/g, '');
|
|
264
|
+
text = text.replace(/\{\\stylesheet[^}]*\}/g, '');
|
|
265
|
+
text = text.replace(/\{\\info[^}]*\}/g, '');
|
|
266
|
+
text = text.replace(/\{\\(\*)?\\[a-z]+[^}]*\}/g, '');
|
|
166
267
|
// Decodifica caracteres especiais
|
|
167
268
|
text = text.replace(/\\'([0-9a-fA-F]{2})/g, (match, hex) => {
|
|
168
269
|
return String.fromCharCode(parseInt(hex, 16));
|
|
169
270
|
});
|
|
170
271
|
// Converte \par em quebra de linha ANTES de remover outros comandos
|
|
171
|
-
text = text.replace(/\\par\b/g,
|
|
272
|
+
text = text.replace(/\\par\b/g, '\n');
|
|
172
273
|
// Remove comandos RTF
|
|
173
|
-
text = text.replace(/\\[a-z]{1,32}(-?\d{1,10})?[ ]?/gi,
|
|
274
|
+
text = text.replace(/\\[a-z]{1,32}(-?\d{1,10})?[ ]?/gi, ' ');
|
|
174
275
|
// Remove chaves, barras e ponto e vírgula soltos
|
|
175
|
-
text = text.replace(/[\{\}\\]/g,
|
|
176
|
-
text = text.replace(/^[;\s]+/gm,
|
|
276
|
+
text = text.replace(/[\{\}\\]/g, '');
|
|
277
|
+
text = text.replace(/^[;\s]+/gm, ''); // Remove ; no início de linhas
|
|
177
278
|
// Limpa quebras e espaços DUPLICADOS (mas mantém quebras únicas)
|
|
178
|
-
text = text.replace(/[\r\n]{2,}/g,
|
|
179
|
-
text = text.replace(/ +/g,
|
|
279
|
+
text = text.replace(/[\r\n]{2,}/g, '\n'); // Múltiplas quebras viram uma
|
|
280
|
+
text = text.replace(/ +/g, ' '); // Múltiplos espaços viram um
|
|
180
281
|
text = text.trim();
|
|
181
282
|
// Remove possíveis resíduos de nomes de fontes comuns
|
|
182
|
-
text = text.replace(/^(Arial|Times New Roman|Courier New|MS Sans Serif|Calibri)[;\s]*/i,
|
|
283
|
+
text = text.replace(/^(Arial|Times New Roman|Courier New|MS Sans Serif|Calibri)[;\s]*/i, '');
|
|
183
284
|
// Remove espaço + ponto solto no final
|
|
184
|
-
text = text.replace(/\s*\.\s*$/g,
|
|
285
|
+
text = text.replace(/\s*\.\s*$/g, '.');
|
|
185
286
|
// Remove pontos duplicados e pontos soltos no final
|
|
186
|
-
text = text.replace(/\.+$/g,
|
|
287
|
+
text = text.replace(/\.+$/g, '.');
|
|
187
288
|
return text;
|
|
188
289
|
}
|
|
189
290
|
}
|
package/lib/format-text.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format-text.js","sourceRoot":"","sources":["../src/format-text.ts"],"names":[],"mappings":";;;AAAA,6CAA0D;
|
|
1
|
+
{"version":3,"file":"format-text.js","sourceRoot":"","sources":["../src/format-text.ts"],"names":[],"mappings":";;;AAAA,6CAA0D;AAkC1D;;;;;;;;;;GAUG;AACH,SAAS,oBAAoB,CAAC,IAAY;IACxC,MAAM,UAAU,GAAG,IAAI,CAAC,S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,CAAC,8BAA8B;QACxE,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC,6BAA6B;QAE9D,IAAI,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;QAEnB,sDAAsD;QACtD,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,mEAAmE,EAAE,EAAE,CAAC,CAAC;QAE7F,uCAAuC;QACvC,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,GAAG,CAAC,CAAC;QAEvC,oDAAoD;QACpD,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;QAElC,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AA1RD,gCA0RC"}
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@senhainfo/shared-utils",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/senha-info/senha-shared-utils.git"
|
|
7
7
|
},
|
|
8
|
-
"author": "Bruno Gaspar <
|
|
8
|
+
"author": "Bruno Gaspar <dev.brunogaspar@gmail.com>",
|
|
9
9
|
"license": "MIT",
|
|
10
10
|
"main": "./lib/index.js",
|
|
11
11
|
"types": "./lib/index.d.ts",
|