Skip to content

Commit

Permalink
chore: build
Browse files Browse the repository at this point in the history
  • Loading branch information
mesqueeb committed Dec 31, 2021
1 parent 953b801 commit dfdaf8a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 11 deletions.
10 changes: 6 additions & 4 deletions dist/index.es.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ function capitaliseWord(string) {
*/
function camelCase(string, options = { keepSpecialCharacters: false }) {
return splitAndPrefix(string, options).reduce((result, word, index) => {
return index === 0 || !word[0].match(magicSplit) ? result + word.toLowerCase() : result + capitaliseWord(word);
return index === 0 || !(word[0] || '').match(magicSplit)
? result + word.toLowerCase()
: result + capitaliseWord(word);
}, '');
}
/**
Expand Down Expand Up @@ -209,7 +211,7 @@ function cobolCase(string, options = { keepSpecialCharacters: false }) {
.toUpperCase();
}
/**
* # 📍 dot.notation
* # 📍 Dot.notation
* converts a string to dot.notation
* - adds dots, does not change casing
* - *strips away* special characters by default
Expand All @@ -223,7 +225,7 @@ function dotNotation(string, options = { keepSpecialCharacters: false }) {
return splitAndPrefix(string, Object.assign(Object.assign({}, options), { prefix: '.' })).join('');
}
/**
* # 📂 path/case
* # 📂 Path/case
* converts a string to path/case
* - adds slashes, does not change casing
* - *keeps* special characters by default
Expand All @@ -240,7 +242,7 @@ function pathCase(string, options = { keepSpecialCharacters: true }) {
}, '');
}
/**
* # 🛰 space case
* # 🛰 Space case
* converts a string to space case
* - adds spaces, does not change casing
* - *keeps* special characters by default
Expand Down
10 changes: 6 additions & 4 deletions dist/index.umd.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@
*/
function camelCase(string, options = { keepSpecialCharacters: false }) {
return splitAndPrefix(string, options).reduce((result, word, index) => {
return index === 0 || !word[0].match(magicSplit) ? result + word.toLowerCase() : result + capitaliseWord(word);
return index === 0 || !(word[0] || '').match(magicSplit)
? result + word.toLowerCase()
: result + capitaliseWord(word);
}, '');
}
/**
Expand Down Expand Up @@ -215,7 +217,7 @@
.toUpperCase();
}
/**
* # 📍 dot.notation
* # 📍 Dot.notation
* converts a string to dot.notation
* - adds dots, does not change casing
* - *strips away* special characters by default
Expand All @@ -229,7 +231,7 @@
return splitAndPrefix(string, Object.assign(Object.assign({}, options), { prefix: '.' })).join('');
}
/**
* # 📂 path/case
* # 📂 Path/case
* converts a string to path/case
* - adds slashes, does not change casing
* - *keeps* special characters by default
Expand All @@ -246,7 +248,7 @@
}, '');
}
/**
* # 🛰 space case
* # 🛰 Space case
* converts a string to space case
* - adds spaces, does not change casing
* - *keeps* special characters by default
Expand Down
6 changes: 3 additions & 3 deletions dist/types/core.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ export declare function cobolCase(string: string, options?: {
keepSpecialCharacters: boolean;
}): string;
/**
* # 📍 dot.notation
* # 📍 Dot.notation
* converts a string to dot.notation
* - adds dots, does not change casing
* - *strips away* special characters by default
Expand All @@ -137,7 +137,7 @@ export declare function dotNotation(string: string, options?: {
keepSpecialCharacters: boolean;
}): string;
/**
* # 📂 path/case
* # 📂 Path/case
* converts a string to path/case
* - adds slashes, does not change casing
* - *keeps* special characters by default
Expand All @@ -151,7 +151,7 @@ export declare function pathCase(string: string, options?: {
keepSpecialCharacters: boolean;
}): string;
/**
* # 🛰 space case
* # 🛰 Space case
* converts a string to space case
* - adds spaces, does not change casing
* - *keeps* special characters by default
Expand Down

0 comments on commit dfdaf8a

Please sign in to comment.