Skip to content

Commit

Permalink
chore: build
Browse files Browse the repository at this point in the history
  • Loading branch information
mesqueeb committed Jun 5, 2024
1 parent baae8b6 commit 2da70de
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions dist/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// [À-ÖØ-ß]
// lower case ranges
// [à-öø-ÿ]
export const magicSplit = /^[a-zà-öø-ÿ]+|[A-ZÀ-ÖØ-ß][a-zà-öø-ÿ]+|[a-zà-öø-ÿ]+|[0-9]+|[A-ZÀ-ÖØ-ß]+(?![a-zà-öø-ÿ])/g;
export const magicSplit = /^[a-zà-öø-ÿа-я]+|[A-ZÀ-ÖØ-ßА-Я][a-zà-öø-ÿа-я]+|[a-zà-öø-ÿа-я]+|[0-9]+|[A-ZÀ-ÖØ-ßА-Я]+(?![a-zà-öø-ÿа-я])/g;
export const spaceSplit = /\S+/g;
/**
* A string.matchAll function that will return an array of "string parts" and the indexes at which it split each part
Expand Down Expand Up @@ -45,7 +45,9 @@ export function splitAndPrefix(string, options) {
let part = _part;
if (keepSpecialCharacters === false) {
if (keep) {
part = part.normalize('NFD').replace(new RegExp(`[^a-zA-ZØßø0-9${keep.join('')}]`, 'g'), '');
part = part
.normalize('NFD')
.replace(new RegExp(`[^a-zA-ZØßø0-9${keep.join('')}]`, 'g'), '');
}
if (!keep) {
part = part.normalize('NFD').replace(/[^a-zA-ZØßø0-9]/g, '');
Expand Down Expand Up @@ -83,5 +85,6 @@ export function splitAndPrefix(string, options) {
export function capitaliseWord(string) {
const match = string.matchAll(magicSplit).next().value;
const firstLetterIndex = match ? match.index : 0;
return string.slice(0, firstLetterIndex + 1).toUpperCase() + string.slice(firstLetterIndex + 1).toLowerCase();
return (string.slice(0, firstLetterIndex + 1).toUpperCase() +
string.slice(firstLetterIndex + 1).toLowerCase());
}

0 comments on commit 2da70de

Please sign in to comment.