-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #279 from bmish/rule-link
Ensure deprecated rule replacement link respects `--path-rule-doc`
- Loading branch information
Showing
7 changed files
with
252 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,27 @@ | ||
import camelCase from 'camelcase'; | ||
|
||
export function countOccurrencesInString(str: string, substring: string) { | ||
return str.split(substring).length - 1; | ||
} | ||
|
||
export function toSentenceCase(str: string) { | ||
return str.replace(/^\w/u, function (txt) { | ||
return txt.charAt(0).toUpperCase() + txt.slice(1).toLowerCase(); | ||
}); | ||
} | ||
|
||
export function removeTrailingPeriod(str: string) { | ||
return str.replace(/\.$/u, ''); | ||
} | ||
|
||
/** | ||
* Example: theWeatherIsNice => The Weather Is Nice | ||
*/ | ||
export function camelCaseStringToTitle(str: string) { | ||
const text = str.replace(/([A-Z])/gu, ' $1'); | ||
return text.charAt(0).toUpperCase() + text.slice(1); | ||
} | ||
|
||
export function isCamelCase(str: string) { | ||
return camelCase(str) === str; | ||
} |
Oops, something went wrong.