Supported Scalars
Please visit validator.js for documentation and specifics of individual validators
- Not all validators in validator.js are implemented.
DateTimeis an additional validation
Available scalars
Includes mock generators when built-in support is available. When a field is marked as a scalar, a mock generator function is created. The list below indicates which function from faker.js it maps to, when available. Scalars marked as - generate the mock function scaffolding, and will require providing custom generators.
| Scalar | Mock | Description | |
|---|---|---|---|
| 1 | Alpha | faker.random.alpha | String contains only letters (a-zA-Z). Locale picked from context |
| 2 | Alphanumeric | faker.ransom.alphaNumeric | String contains only letters and numbers (a-zA-Z0-9) |
| 3 | Ascii | faker.random.alpha | String contains ASCII chars only |
| 4 | Base32 | - | String is base32 encoded |
| 5 | Base58 | - | String is base58 encoded |
| 6 | Base64 | - | String is base64 encoded. ([url safe](https://base |
| 7 | BIC | - | String is a BIC (Bank Identification Code) or SWIFT code |
| 8 | BtcAddress | faker.finance.bitcoinAddress | String is a valid BTC address |
| 9 | ByteLength | - | String is of length (in UTF-8 bytes) falls in a range |
| 10 | CreditCard | faker.finance.creditCardNumber | String is a credit card |
| 11 | Currency | faker.finance.amount | String is a valid currency amount |
| 12 | DataURI | faker.image.dataUri | String is a data uri format |
| 13 | Date | faker.date.past | String is a valid date.e.g. [2002-07-15, new Date()] |
| 14 | DateTime | faker.datatype.datetime | String is a valid Prisma DateTime (ISO 8601, strict-mode date) |
| 15 | EAN | - | String is an EAN (European Article Number) |
| 16 | faker.internet.email | String is an email | |
| 17 | Empty | built-in | String has a length of zero |
| 18 | EthereumAddress | faker.finance.ethereumAddress | String is an Ethereum address using basic regex. Does not validate address checksums |
| 19 | FQDN | faker.internet.domainName | String is a fully qualified domain name (e.g. domain.com) |
| 20 | FullWidth | - | String contains any full-width chars |
| 21 | HalfWidth | - | String contains any half-width chars |
| 22 | HashMd4 | built-in | String is a hash of type algorithm |
| 23 | HashMd5 | built-in | String is a hash of type 'md5' |
| 24 | HashSha1 | built-in | String is a hash of type 'sha1' |
| 25 | HashSha256 | built-in | String is a hash of type 'sha256' |
| 26 | HashSha384 | built-in | String is a hash of type 'sha384' |
| 27 | HashSha512 | built-in | String is a hash of type 'sha512' |
| 28 | HashRipemd128 | - | String is a hash of type 'ripemd128' |
| 29 | HashRipemd160 | - | String is a hash of type 'ripemd160' |
| 30 | HashTiger128 | - | String is a hash of type 'tiger128' |
| 31 | HashTiger160 | - | String is a hash of type 'tiger160' |
| 32 | HashTiger192 | - | String is a hash of type 'tiger192' |
| 33 | HashCrc32 | - | String is a hash of type 'crc32' |
| 34 | HashCrc32b | - | String is a hash of type 'crc32b' |
| 35 | Hexadecimal | faker.datatype.hexaDecimal | String is a hexadecimal number |
| 36 | HexColor | built-in | String is a hexadecimal color |
| 37 | HSL | built-in | String is an HSL (hue, saturation, lightness, optional alpha) |
| 38 | IBAN | faker.finance.iban | String is a IBAN (International Bank Account Number) |
| 39 | IP | faker.internet.ip | String is an IP (version 4 or 6) (version==undefined => either) |
| 40 | IPv4 | faker.internet.ip | String is an IP (version 4 or 6) (version==undefined => either) |
| 41 | IPv6 | faker.internet.ipv6 | String is an IP (version 4 or 6) (version==undefined => either) |
| 42 | IPRange | - | String is an IP Range (version 4 or 6) (version==undefined => either) |
| 43 | ISBN | - | String is an ISBN (version 10 or 13) (version==undefined => either) |
| 44 | ISIN | - | String is an [ISIN][ISIN] (stock/security identifier) |
| 45 | ISO8601 | - | String is a valid ISO 8601 date |
| 46 | ISO31661Alpha2 | - | String is a valid ISO 3166-1 alpha-2 officially assigned country code |
| 47 | ISO31661Alpha3 | - | String is a valid ISO 3166-1 alpha-3 officially assigned country code |
| 48 | ISRC | - | String is a ISRC |
| 49 | ISSN | - | String is an ISSN |
| 50 | Json | faker.datatype.json | String is valid JSON (note: uses JSON.parse) |
| 51 | JWT | - | String is valid JWT token |
| 52 | LatLong | built-in | String is a valid latitude-longitude coordinate in the format lat, long or lat, long |
| 53 | Length | - | String's length falls in a range |
| 54 | Locale | faker.random.locale | String is a locale |
| 55 | Lowercase | built-in | String is lowercase |
| 56 | MACAddress | faker.internet.mac | String is a MAC address |
| 57 | MimeType | faker.system.mimeType | String matches to a valid MIME type format |
| 58 | MobilePhone | faker.phone.phoneNumber | String is a mobile phone number |
| 59 | MongoId | - | String is a valid hex-encoded representation of a [MongoDB ObjectId][mongoid] |
| 60 | Multibyte | - | String contains one or more multibyte chars |
| 61 | Numeric | faker.datatype.number | String contains only numbers |
| 62 | Octal | built-in | String is a valid octal number |
| 63 | PassportNumber | - | String is a valid passport number |
| 64 | Port | faker.internet.port | String is a valid port number |
| 65 | PostalCode | faker.address.zipCode | String is a postal code |
| 66 | RFC3339 | - | String is a valid RFC 3339 date |
| 67 | RgbColor | built-in | String is a rgb or rgba color |
| 68 | SemVer | faker.system.semver | String is a Semantic Versioning Specification (SemVer) |
| 69 | SurrogatePair | - | String contains any surrogate pairs chars |
| 70 | Uppercase | built-in | String is uppercase |
| 71 | Slug | faker.lorem.slug | String is of type slug |
| 72 | StrongPassword | faker.internet.password | String is strong password or not. Allows for custom requirements or scoring rules. If returnScore is true, then the function returns an integer score for the password rather than a boolean |
| 73 | URL | faker.internet.url | String is an URL |
| 74 | UUID | faker.datatype.uuid | String is a UUID (version 3, 4 or 5) |
| 75 | VariableWidth | - | String contains a mixture of full and half-width chars |
| 76 | VAT | - | String is a valid VAT number |