diff options
author | 2020-03-18 12:35:28 +0100 | |
---|---|---|
committer | 2020-03-18 12:35:28 +0100 | |
commit | 342b9a89e591d779d8f759a422b8c5b54ee68893 (patch) | |
tree | 302168c56821205c37f0d2acea27dd49cd642ba7 /source/libs/utils.ts | |
parent | 47bae5f939d8ac4b3416749480aa5e85e0654c80 (diff) | |
download | refined-github-342b9a89e591d779d8f759a422b8c5b54ee68893.tar.gz refined-github-342b9a89e591d779d8f759a422b8c5b54ee68893.tar.zst refined-github-342b9a89e591d779d8f759a422b8c5b54ee68893.zip |
Meta: Standardize number parsing
Diffstat (limited to 'source/libs/utils.ts')
-rw-r--r-- | source/libs/utils.ts | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/source/libs/utils.ts b/source/libs/utils.ts index 00009233..64c76ccf 100644 --- a/source/libs/utils.ts +++ b/source/libs/utils.ts @@ -173,3 +173,7 @@ export function reportBug(featureName: string, bugName: string): void { export function getScopedSelector(selector: string): string { return selector.split(',').map(sub => `:scope > ${sub.trim()}`).join(','); } + +export function looseParseInt(text: string): number { + return Number(text.replace(/\D+/g, '')); +} |