Private Validation
npm install e2ps-validation
const formChange = (e) => {
e.preventDefault();
const value = e2val.alphaNumeric(e.target.value);
if (value === null) return;
...update state
};
`
Methods
$3
> Validation methods return the argument set in the value parameter on truthy evaluations and returns null on falsely evaluations.
- alphaNumeric(value)
- alphaNumericPlus(value)
- creditCard(value)
- email(value)
- money(value)
- numberMax(value)
- number(value)
- phone(value)
$3
> Formatting methods ensure consistent formation across E2PS applications.
- dateParser()
- moneyFormatParser()
- TurnTimeParser()
#### Date Parser
Syntax
`
dateParser(date,display,time)
`
Parameter Values
|Parameter |Description |Options |
|----------------|-------------------------------|-----------------------------|
|date |Required. The timestamp to format |
|display |Optional. Date format. Default > sm |xs, sm, md, lg
|time |Optional Show time. Default > false |true, false
#### Money Format Parser
Syntax
`
moneyFormatParser(amount,decimalCount,decimal,thousands)
`
Parameter Values
|Parameter |Description |Options |
|----------------|-------------------------------|-----------------------------|
|amount |Required. The amount to format |
|decimalCount |Optional. Decimal placement Default > 2 |numeric values
|decimal |Optional. Sets the separator for the decimal point. Default > . |
|thousands |Optional. Sets the thousands separator. Default > , |
#### Turn Time Parser
Syntax
`
TurnTimeParser(orderDate, turnTimeDays, cutOffTime)
``