@dicebear/initials 9.2.4 → 9.3.0-alpha.1
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/utils/initials.js +7 -1
- package/package.json +3 -3
package/lib/utils/initials.js
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
// @see https://www.regular-expressions.info/unicode.html
|
|
2
2
|
export function getInitials(seed, discardAtSymbol = true) {
|
|
3
|
-
|
|
3
|
+
let input = seed;
|
|
4
|
+
// Optionally discard everything after `@`-symbol
|
|
5
|
+
if (discardAtSymbol) {
|
|
6
|
+
input = seed.replace(/@.*/, '');
|
|
7
|
+
}
|
|
8
|
+
// Remove common apostrophes
|
|
9
|
+
input = input.replace(/[`´‘’'ʼ]/g, '');
|
|
4
10
|
const matches = input.match(/(\p{L}[\p{L}\p{M}]*)/gu);
|
|
5
11
|
if (!matches) {
|
|
6
12
|
// Re-run without discarding `@`-symbol, if no matches
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dicebear/initials",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.3.0-alpha.1",
|
|
4
4
|
"description": "Initials avatar style for DiceBear",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"dicebear"
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"test": "uvu tests"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@dicebear/core": "9.
|
|
32
|
+
"@dicebear/core": "9.3.0-alpha.1",
|
|
33
33
|
"@tsconfig/recommended": "^1.0.10",
|
|
34
34
|
"del-cli": "^6.0.0",
|
|
35
35
|
"typescript": "^5.8.3",
|
|
@@ -44,5 +44,5 @@
|
|
|
44
44
|
"publishConfig": {
|
|
45
45
|
"access": "public"
|
|
46
46
|
},
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "eb64af00014e95b66f3308d9d756f2897a4c02e1"
|
|
48
48
|
}
|