# minimalistic-js

> Cross-platform simple validation

Latest version **1.1.4** (published 2017-12-04) · ISC license · 0 weekly downloads

## Install

```sh
npm install minimalistic-js
pnpm add minimalistic-js
yarn add minimalistic-js
bun add minimalistic-js
```

## 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.1.4 |
| Published | 2017-12-04 |
| First published | 2017-04-03 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | leadsoft |
| Maintainers | kuzmenko1256 |
| Keywords | validation, simple validation, js validation, custom validation, reg validation, nodejs validation, node validation, node.js validation, react |

## Links

- npm: https://www.npmjs.com/package/minimalistic-js
- Repository: https://github.com/LeadSoftInc/minimalistic.js
- Issues: https://github.com/LeadSoftInc/minimalistic.js/issues
- npm.io page: https://npm.io/package/minimalistic-js

## 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.1.4 (latest) — 2017-12-04
- 1.1.3 — 2017-04-12
- 1.1.2 — 2017-04-07
- 1.1.1 — 2017-04-06
- 1.1.0 — 2017-04-06
- 1.0.3 — 2017-04-06
- 1.0.2 — 2017-04-06
- 1.0.0 — 2017-04-03

## README

# minimalistic.js

### Installation
To install the stable version:
```
npm install --save minimalistic-js
```

### Example validation
#### Check string
```javascript
import { validation, methods } from 'minimalistic-js';

const loginError = validation({
    value: 'admin', // input value
    methods: { // check methods
        required: methods.required,
        email: methods.isEmail
    },
    messages: { // error messages
        required: 'The field is required',
        email: 'The email address entered is invalid'
    }
});

if (loginError) {
    console.warn(loginError);
}
```

#### Check file
```javascript
import { validation, methods } from 'minimalistic-js';

const fileError = validation({
    value: File, // your file
    methods: { // check methods
        required: methods.required,
        maxFileSize: methods.maxFileSize(100000)
    },
    messages: { // error messages
        required: 'The field is required',
        maxFileSize: 'The maximum file size is 100kb'
    }
});

if (fileError) {
    console.warn(fileError);
}
```

#### Example ES5 Node.js
```javascript
var minimalisticJs = require("minimalistic-js");

var fieldError = minimalisticJs.validation({
    value: '',
    methods: { // check methods
        required: minimalisticJs.methods.required
    },
    messages: { // error messages
        required: 'The field is required'
    }
});

if (fieldError) {
    console.warn(fieldError);
}
```

### Check methods
https://github.com/LeadSoftInc/minimalistic.js/blob/master/src/methods.js

### Create custom check method
```javascript
import { validation } from 'minimalistic-js';

// custom check method
function customMethod(value) {
    return value.length === 0;
}

const fieldError = validation({
    value: '', // your value
    methods: { // check methods
        custom: customMethod
    },
    messages: { // error messages
        custom: 'Custom error message'
    }
});

if (fieldError) {
    console.warn(fieldError);
}
```

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