https://github.com/stetsd/univalid-strategy
Abstract class of strategy for univalid module (base API)
https://github.com/stetsd/univalid-strategy
univalid univalid-strategy validation
Last synced: 6 months ago
JSON representation
Abstract class of strategy for univalid module (base API)
- Host: GitHub
- URL: https://github.com/stetsd/univalid-strategy
- Owner: stetsd
- Created: 2018-03-01T04:51:42.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-07-04T03:31:53.000Z (about 8 years ago)
- Last Synced: 2025-09-22T10:02:27.558Z (10 months ago)
- Topics: univalid, univalid-strategy, validation
- Language: JavaScript
- Size: 3.91 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# univalid-strategy
Abstract class of strategy for [univalid](https://github.com/StetsD/univalid) module.
## Install
```sh
npm i univalid-strategy
```
## Usage
```js
const UnivalidStrategy = require('univalid-strategy');
class UnivalidStrategyDefault extends UnivalidStrategy {
//...
}
```
## API
Methods are necessary for define and extend.
### applyFilter(filter, val)
Tests the pattern matching of symbols (by event)
**filter** - Type `string`
In current moment available patterns:
* oL - only latin symbols
* oC - only cyrillic symbols
* oN - only numbers
* oP - only numbers and latin symbols
**val** - Type `string`
### check()
### getValidationHandlers()
### set()
### get()
## OPTIONS
### validHandlers
```js
constructor(){
this.validHandlers = {
'required': (val) => {
let data = val ? ('' + val).trim() : '';
return !!data;
}
}
}
```
## License
ISC©