# global-validation

> Validation methods

Latest version **0.1.2** (published 2015-06-03) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install global-validation
pnpm add global-validation
yarn add global-validation
bun add global-validation
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.1.2 |
| Published | 2015-06-03 |
| First published | 2015-05-31 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 (+5 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Andrius Skerla |
| Maintainers | rainder |
| Keywords | validation, global, constructor |

## Links

- npm: https://www.npmjs.com/package/global-validation
- Repository: https://github.com/rainder/global-validation
- Homepage: https://github.com/rainder/global-validation#readme
- Issues: https://github.com/rainder/global-validation/issues
- npm.io page: https://npm.io/package/global-validation

## Dependencies (1)

- [lodash](https://npm.io/package/lodash.md) ^2.4.1

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 0.1.2 (latest) — 2015-06-03
- 0.1.1 — 2015-06-02
- 0.1.0 — 2015-05-31

## README

# Global Validation

## Confession
This package modifies global `String`, `Object`, `Array`, `Function`, `Number` and `Boolean` constructor properties. I feel bad about it. Really.

## Usage
```js
require('global-validation');

//string
var validate = String.type().min(5);
validate('Hello world'); //ok

//array
var validate = Array.type().min(3).oneOf([1, 2, 3, 4, 5]).typeOf(Number);
validate([1, 1, 2, 2, 1, 2]); //ok

//object
var validate = Object.type().fn(function (value, arg1, arg2) {
  console.log(this, value, arg1, arg2);
  return true;
});
validate.call(ctx, {
  name: 'Skerla'
}, arg1, arg2); //ok

//object
var validate = Object.type();
validate.call(ctx, 'not an object'); //fails

```

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