- Source:
Methods
(static) "ANY.ALLOW"(params)
Parameters:
Name | Type | Description |
---|---|---|
params |
Object |
Returns message related to any.allow |
- Source:
Example
import { ERROR_MESSAGES, ERROR_KEYS } from 'egoist-js'
const messageFn = ERROR_MESSAGES[ERROR_KEYS.ANY.ALLOW]
console.log(messageFn({ label: 'Superfield', args: ['hello', 'world'] }))
// Superfield should be one of allowed values: hello, world
(static) "ANY.REQUIRED"(params)
Parameters:
Name | Type | Description |
---|---|---|
params |
Object |
Returns message related to any.required |
- Source:
Example
import { ERROR_MESSAGES, ERROR_KEYS } from 'egoist-js'
const messageFn = ERROR_MESSAGES[ERROR_KEYS.ANY.REQUIRED]
console.log(messageFn({ label: 'Superfield' })) // Superfield is required
(static) "ANY.UNKNOWN"(params)
Parameters:
Name | Type | Description |
---|---|---|
params |
Object |
Returns message related to any.unknown |
- Source:
Example
import { ERROR_MESSAGES, ERROR_KEYS } from 'egoist-js'
const messageFn = ERROR_MESSAGES[ERROR_KEYS.ANY.UNKNOWN]
console.log(messageFn({ label: 'Superfield' })) // Superfield contains errors
(static) "ARRAY.EVERY"(params)
Parameters:
Name | Type | Description |
---|---|---|
params |
Object |
Returns message related to array.every |
- Source:
Example
import { ERROR_MESSAGES, ERROR_KEYS } from 'egoist-js'
const messageFn = ERROR_MESSAGES[ERROR_KEYS.ARRAY.EVERY]
console.log(messageFn({ label: 'Superfield' }))
// Superfield items should follow the rule
(static) "ARRAY.IN_RANGE"(params)
Parameters:
Name | Type | Description |
---|---|---|
params |
Object |
Returns message related to array.range |
- Source:
Example
import { ERROR_MESSAGES, ERROR_KEYS } from 'egoist-js'
const messageFn = ERROR_MESSAGES[ERROR_KEYS.ARRAY.IN_RANGE]
console.log(messageFn({ label: 'Superfield', args: [5, 10] }))
// Superfield should have length between 5 and 10
(static) "ARRAY.LENGTH"(params)
Parameters:
Name | Type | Description |
---|---|---|
params |
Object |
Returns message related to array.exact.length |
- Source:
Example
import { ERROR_MESSAGES, ERROR_KEYS } from 'egoist-js'
const messageFn = ERROR_MESSAGES[ERROR_KEYS.ARRAY.LENGTH]
console.log(messageFn({ label: 'Superfield', args: 5 }))
// Superfield should have 5 items
(static) "ARRAY.MAX_LENGTH"(params)
Parameters:
Name | Type | Description |
---|---|---|
params |
Object |
Returns message related to array.max.length |
- Source:
Example
import { ERROR_MESSAGES, ERROR_KEYS } from 'egoist-js'
const messageFn = ERROR_MESSAGES[ERROR_KEYS.ARRAY.MAX_LENGTH]
console.log(messageFn({ label: 'Superfield', args: 5 }))
// Superfield should have at most 5 items
(static) "ARRAY.MIN_LENGTH"(params)
Parameters:
Name | Type | Description |
---|---|---|
params |
Object |
Returns message related to array.min.length |
- Source:
Example
import { ERROR_MESSAGES, ERROR_KEYS } from 'egoist-js'
const messageFn = ERROR_MESSAGES[ERROR_KEYS.ARRAY.MIN_LENGTH]
console.log(messageFn({ label: 'Superfield', args: 5 }))
// Superfield should have at least 5 items
(static) "ARRAY.SOME"(params)
Parameters:
Name | Type | Description |
---|---|---|
params |
Object |
Returns message related to array.some |
- Source:
Example
import { ERROR_MESSAGES, ERROR_KEYS } from 'egoist-js'
const messageFn = ERROR_MESSAGES[ERROR_KEYS.ARRAY.SOME]
console.log(messageFn({ label: 'Superfield' }))
// Superfield should have at least one item that follows the rule
(static) "ARRAY.TYPE"(params)
Parameters:
Name | Type | Description |
---|---|---|
params |
Object |
Returns message related to array.type |
- Source:
Example
import { ERROR_MESSAGES, ERROR_KEYS } from 'egoist-js'
const messageFn = ERROR_MESSAGES[ERROR_KEYS.ARRAY.TYPE]
console.log(messageFn({ label: 'Superfield' }))
// Superfield should be an array
(static) "BOOLEAN.FALSY"(params)
Parameters:
Name | Type | Description |
---|---|---|
params |
Object |
Returns message related to boolean.falsy |
- Source:
Example
import { ERROR_MESSAGES, ERROR_KEYS } from 'egoist-js'
const messageFn = ERROR_MESSAGES[ERROR_KEYS.BOOLEAN.FALSY]
console.log(messageFn({ label: 'Superfield' }))
// Superfield should be false
(static) "BOOLEAN.TRUTHY"(params)
Parameters:
Name | Type | Description |
---|---|---|
params |
Object |
Returns message related to boolean.truthy |
- Source:
Example
import { ERROR_MESSAGES, ERROR_KEYS } from 'egoist-js'
const messageFn = ERROR_MESSAGES[ERROR_KEYS.BOOLEAN.TRUTHY]
console.log(messageFn({ label: 'Superfield' }))
// Superfield should be true
(static) "BOOLEAN.TYPE"(params)
Parameters:
Name | Type | Description |
---|---|---|
params |
Object |
Returns message related to boolean.type |
- Source:
Example
import { ERROR_MESSAGES, ERROR_KEYS } from 'egoist-js'
const messageFn = ERROR_MESSAGES[ERROR_KEYS.BOOLEAN.TYPE]
console.log(messageFn({ label: 'Superfield' }))
// Superfield should be a boolean
(static) "NUMBER.GE"(params)
Parameters:
Name | Type | Description |
---|---|---|
params |
Object |
Returns message related to number.ge |
- Source:
Example
import { ERROR_MESSAGES, ERROR_KEYS } from 'egoist-js'
const messageFn = ERROR_MESSAGES[ERROR_KEYS.NUMBER.GE]
console.log(messageFn({ label: 'Superfield', args: 5 }))
// Superfield should be greater than or equal 5
(static) "NUMBER.GT"(params)
Parameters:
Name | Type | Description |
---|---|---|
params |
Object |
Returns message related to number.gt |
- Source:
Example
import { ERROR_MESSAGES, ERROR_KEYS } from 'egoist-js'
const messageFn = ERROR_MESSAGES[ERROR_KEYS.NUMBER.GT]
console.log(messageFn({ label: 'Superfield', args: 5 }))
// Superfield should be greater than 5
(static) "NUMBER.LE"(params)
Parameters:
Name | Type | Description |
---|---|---|
params |
Object |
Returns message related to number.le |
- Source:
Example
import { ERROR_MESSAGES, ERROR_KEYS } from 'egoist-js'
const messageFn = ERROR_MESSAGES[ERROR_KEYS.NUMBER.LE]
console.log(messageFn({ label: 'Superfield', args: 5 }))
// Superfield should be lower than or equal 5
(static) "NUMBER.LT"(params)
Parameters:
Name | Type | Description |
---|---|---|
params |
Object |
Returns message related to number.lt |
- Source:
Example
import { ERROR_MESSAGES, ERROR_KEYS } from 'egoist-js'
const messageFn = ERROR_MESSAGES[ERROR_KEYS.NUMBER.LT]
console.log(messageFn({ label: 'Superfield', args: 5 }))
// Superfield should be less than 5
(static) "NUMBER.RANGE"(params)
Parameters:
Name | Type | Description |
---|---|---|
params |
Object |
Returns message related to number.range |
- Source:
Example
import { ERROR_MESSAGES, ERROR_KEYS } from 'egoist-js'
const messageFn = ERROR_MESSAGES[ERROR_KEYS.NUMBER.RANGE]
console.log(messageFn({ label: 'Superfield', args: [5, 10] }))
// Superfield should be lower than 10 and greater or equal 5
(static) "NUMBER.TYPE"(params)
Parameters:
Name | Type | Description |
---|---|---|
params |
Object |
Returns message related to number.type |
- Source:
Example
import { ERROR_MESSAGES, ERROR_KEYS } from 'egoist-js'
const messageFn = ERROR_MESSAGES[ERROR_KEYS.NUMBER.TYPE]
console.log(messageFn({ label: 'Superfield' }))
// Superfield should be a number
(static) "SHAPE.ALLOWED_KEYS"(params)
Parameters:
Name | Type | Description |
---|---|---|
params |
Object |
Returns message related to shape.allowed.keys |
- Source:
Example
import { ERROR_MESSAGES, ERROR_KEYS } from 'egoist-js'
const messageFn = ERROR_MESSAGES[ERROR_KEYS.SHAPE.ALLOWED_KEYS]
console.log(messageFn({ label: 'Superfield', value: { prop3: null }, args: ['prop1', 'prop2'] }))
// Superfield contains: prop3, but should contain only keys: prop1, prop2
(static) "SHAPE.EXPECTED_KEYS"(params)
Parameters:
Name | Type | Description |
---|---|---|
params |
Object |
Returns message related to shape.expected.keys |
- Source:
Example
import { ERROR_MESSAGES, ERROR_KEYS } from 'egoist-js'
const messageFn = ERROR_MESSAGES[ERROR_KEYS.SHAPE.EXPECTED_KEYS]
console.log(messageFn({ label: 'Superfield', value: { prop3: 1 }, args: ['prop1', 'prop2'] }))
// Superfield contains: prop3, but should have keys: prop1, prop2
(static) "SHAPE.FORBIDDEN_KEYS"(params)
Parameters:
Name | Type | Description |
---|---|---|
params |
Object |
Returns message related to shape.forbidden.keys |
- Source:
Example
import { ERROR_MESSAGES, ERROR_KEYS } from 'egoist-js'
const messageFn = ERROR_MESSAGES[ERROR_KEYS.SHAPE.FORBIDDEN_KEYS]
console.log(messageFn({ label: 'Superfield', args: ['prop1', 'prop2'] }))
// Superfield contains forbidden keys: prop1, prop2
(static) "SHAPE.TYPE"(params)
Parameters:
Name | Type | Description |
---|---|---|
params |
Object |
Returns message related to shape.type |
- Source:
Example
import { ERROR_MESSAGES, ERROR_KEYS } from 'egoist-js'
const messageFn = ERROR_MESSAGES[ERROR_KEYS.SHAPE.TYPE]
console.log(messageFn({ label: 'Superfield' }))
// Superfield should be an object
(static) "STRING.ALPHANUM"(params)
Parameters:
Name | Type | Description |
---|---|---|
params |
Object |
Returns message related to string.alphanum |
- Source:
Example
import { ERROR_MESSAGES, ERROR_KEYS } from 'egoist-js'
const messageFn = ERROR_MESSAGES[ERROR_KEYS.STRING.ALPHANUM]
console.log(messageFn({ label: 'Superfield' }))
// Superfield should contain only alphanumeric characters
(static) "STRING.DIGITS"(params)
Parameters:
Name | Type | Description |
---|---|---|
params |
Object |
Returns message related to string.digits |
- Source:
Example
import { ERROR_MESSAGES, ERROR_KEYS } from 'egoist-js'
const messageFn = ERROR_MESSAGES[ERROR_KEYS.STRING.DIGITS]
console.log(messageFn({ label: 'Superfield' }))
// Superfield should contain only digits
(static) "STRING.EMAIL"(params)
Parameters:
Name | Type | Description |
---|---|---|
params |
Object |
Returns message related to string.email |
- Source:
Example
import { ERROR_MESSAGES, ERROR_KEYS } from 'egoist-js'
const messageFn = ERROR_MESSAGES[ERROR_KEYS.STRING.EMAIL]
console.log(messageFn({ label: 'Superfield' }))
// Superfield should be a valid email address
(static) "STRING.EMPTY"(params)
Parameters:
Name | Type | Description |
---|---|---|
params |
Object |
Returns message related to string.empty |
- Source:
Example
import { ERROR_MESSAGES, ERROR_KEYS } from 'egoist-js'
const messageFn = ERROR_MESSAGES[ERROR_KEYS.STRING.EMPTY]
console.log(messageFn({ label: 'Superfield' }))
// Superfield should not be blank
(static) "STRING.ISO_DATE"(params)
Parameters:
Name | Type | Description |
---|---|---|
params |
Object |
Returns message related to string.iso.date |
- Source:
Example
import { ERROR_MESSAGES, ERROR_KEYS } from 'egoist-js'
const messageFn = ERROR_MESSAGES[ERROR_KEYS.STRING.ISO_DATE]
console.log(messageFn({ label: 'Superfield' }))
// Superfield should be an ISO Date
(static) "STRING.LENGTH"(params)
Parameters:
Name | Type | Description |
---|---|---|
params |
Object |
Returns message related to string.exact.length |
- Source:
Example
import { ERROR_MESSAGES, ERROR_KEYS } from 'egoist-js'
const messageFn = ERROR_MESSAGES[ERROR_KEYS.STRING.LENGTH]
console.log(messageFn({ label: 'Superfield', args: 5 }))
// Superfield should have only 5 characters
(static) "STRING.MATCH"(params)
Parameters:
Name | Type | Description |
---|---|---|
params |
Object |
Returns message related to string.match |
- Source:
Example
import { ERROR_MESSAGES, ERROR_KEYS } from 'egoist-js'
const messageFn = ERROR_MESSAGES[ERROR_KEYS.STRING.MATCH]
console.log(messageFn({ label: 'Superfield', args: /[a-zA-Z]/ }))
// Superfield should match the pattern /[a-zA-Z]/
(static) "STRING.MAX_LENGTH"(params)
Parameters:
Name | Type | Description |
---|---|---|
params |
Object |
Returns message related to string.max.length |
- Source:
Example
import { ERROR_MESSAGES, ERROR_KEYS } from 'egoist-js'
const messageFn = ERROR_MESSAGES[ERROR_KEYS.STRING.MAX_LENGTH]
console.log(messageFn({ label: 'Superfield', args: 5 }))
// Superfield should have at most 5 characters
(static) "STRING.MIN_LENGTH"(params)
Parameters:
Name | Type | Description |
---|---|---|
params |
Object |
Returns message related to string.min.length |
- Source:
Example
import { ERROR_MESSAGES, ERROR_KEYS } from 'egoist-js'
const messageFn = ERROR_MESSAGES[ERROR_KEYS.STRING.MIN_LENGTH]
console.log(messageFn({ label: 'Superfield', args: 5 }))
// Superfield should have at least 5 characters
(static) "STRING.TYPE"(params)
Parameters:
Name | Type | Description |
---|---|---|
params |
Object |
Returns message related to string.type |
- Source: