-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
28567da
commit 8b1fda9
Showing
3 changed files
with
48 additions
and
41 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,7 @@ | ||
import assertString from './util/assertString'; | ||
import { ALPHA, removeIgnoredCharacters } from './alpha'; | ||
import { ALPHA, validateAlpha } from './alpha'; | ||
|
||
export default function isAlpha(_str, options = {}) { | ||
assertString(_str); | ||
|
||
const { ignore, locale = 'en-US' } = options; | ||
const str = removeIgnoredCharacters(_str, ignore); | ||
|
||
if (ALPHA[locale]) { | ||
return ALPHA[locale].test(str); | ||
} | ||
|
||
throw new Error(`Invalid "locale" '${locale}'`); | ||
export default function isAlpha(_str, options) { | ||
return validateAlpha(_str, options); | ||
} | ||
|
||
export const locales = Object.keys(ALPHA); |
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,17 +1,7 @@ | ||
import assertString from './util/assertString'; | ||
import { ALPHANUMERIC, removeIgnoredCharacters } from './alpha'; | ||
import { ALPHANUMERIC, validateAlphanumeric } from './alpha'; | ||
|
||
export default function isAlphanumeric(_str, options = {}) { | ||
assertString(_str); | ||
|
||
const { ignore, locale = 'en-US' } = options; | ||
const str = removeIgnoredCharacters(_str, ignore); | ||
|
||
if (ALPHANUMERIC[locale]) { | ||
return ALPHANUMERIC[locale].test(str); | ||
} | ||
|
||
throw new Error(`Invalid "locale" '${locale}'`); | ||
export default function isAlphanumeric(_str, options) { | ||
return validateAlphanumeric(_str, options); | ||
} | ||
|
||
export const locales = Object.keys(ALPHANUMERIC); |