Skip to content
Snippets Groups Projects
Commit afdf6bf7 authored by Paul Wayper's avatar Paul Wayper Committed by Alvaro Cabrera Durán
Browse files

String slug format faker (#505)

* Add pattern for 'slug' format

* Add recognition of 'slug' format
parent a6a6635b
Branches
Tags
No related merge requests found
...@@ -13,6 +13,7 @@ const regexps = { ...@@ -13,6 +13,7 @@ const regexps = {
hostname: '[a-zA-Z]{1,33}\\.[a-z]{2,4}', hostname: '[a-zA-Z]{1,33}\\.[a-z]{2,4}',
ipv6: '[a-f\\d]{4}(:[a-f\\d]{4}){7}', ipv6: '[a-f\\d]{4}(:[a-f\\d]{4}){7}',
uri: URI_PATTERN, uri: URI_PATTERN,
slug: '[a-zA-Z\\d_-]+',
// types from draft-0[67] (?) // types from draft-0[67] (?)
'uri-reference': `${URI_PATTERN}${PARAM_PATTERN}`, 'uri-reference': `${URI_PATTERN}${PARAM_PATTERN}`,
......
...@@ -39,6 +39,7 @@ function generateFormat(value, invalid) { ...@@ -39,6 +39,7 @@ function generateFormat(value, invalid) {
case 'idn-email': case 'idn-email':
case 'idn-hostname': case 'idn-hostname':
case 'json-pointer': case 'json-pointer':
case 'slug':
case 'uri-template': case 'uri-template':
case 'uuid': case 'uuid':
return coreFormat(value.format); return coreFormat(value.format);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment