# univalid-strategy-default

> Default strategy implementation for univalid module (extends 'univalid-strategy')

Latest version **1.0.2** (published 2018-07-04) · ISC license · 0 weekly downloads

## Install

```sh
npm install univalid-strategy-default
pnpm add univalid-strategy-default
yarn add univalid-strategy-default
bun add univalid-strategy-default
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2018-07-04 |
| First published | 2018-03-01 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 4.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | 'StetsD' |
| Maintainers | stetsd |
| Keywords | password, input, univalid, validation, univalid-strategy-default, univalid-strategy, strategy, check, validate, form |

## Links

- npm: https://www.npmjs.com/package/univalid-strategy-default
- Repository: https://github.com/StetsD/univalid-strategy-default
- Homepage: https://github.com/StetsD/univalid-strategy-default#readme
- Issues: https://github.com/StetsD/univalid-strategy-default
- npm.io page: https://npm.io/package/univalid-strategy-default

## Dependencies (1)

- [univalid-strategy](https://npm.io/package/univalid-strategy.md) ^1.0.2

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.0.2 (latest) — 2018-07-04
- 1.0.1 — 2018-03-08
- 1.0.0 — 2018-03-01

## README

# univalid-strategy-default

Default strategy for [univalid](https://github.com/StetsD/univalid) module.

Extends [univalid-strategy](https://github.com/StetsD/univalid-strategy) class


## Install

```sh
npm i univalid-strategy-default
```


## Usage

```js
const UnivalidStrategyDefault = require('univalid-strategy-default');
const usd = new UnivalidStrategyDefault();
```


## API


### 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(pack, core)

Validating the pack

**pack** - Type `object`

Structure of pack must be strict. Like that:

name, val, type - required fields
```js
//name, val, type - required fields

[
    {
        name: 'username',
        val: 'Uriy',
        type: 'required',
        filter: 'oL',
        msg: {
            empty: 'You shall not pass',
            invalid: 'Validation error',
            filter: 'Filter error',
            success: 'All right'
        }
    },
    {
        name: 'email',
        val: 'Uriy@mzf.com',
        type: 'email',
        filter: /[a-z]|\s/gi,
        msg: {
            empty: 'You shall not pass',
            invalid: 'Bad email',
            filter: 'Only lat/numbers/specials symbols',
            success: 'All right'
        }
    },
]
```

**core** - Type `object`

The instance of 'univalid' module



### getValidationHandlers()

Get validation handlers.

By default defined in [univalid-strategy](https://github.com/StetsD/univalid-strategy) abstract class


### set(option, val)

Set the option in instance

**option** - Type `string`

```js
usd.set('passConfig', {min: 10, analysis: ['hasLowercase', 'hasDigits', 'hasSpecials']});
```


## OPTIONS


### passConfig

Password config

**By default**

{min: 6, analysis: ['hasUppercase', 'hasLowercase', 'hasDigits', 'hasSpecials']}

```js
const usd = new UnivalidStrategyDefault({
    passConfig: {min: 10, analysis: ['hasLowercase', 'hasDigits', 'hasSpecials']}
});
```

## License
ISC©

---
_Source: https://npm.io/package/univalid-strategy-default · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
