# @types/node-validator

> TypeScript definitions for node-validator

Latest version **0.0.34** (published 2023-11-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install @types/node-validator
pnpm add @types/node-validator
yarn add @types/node-validator
bun add @types/node-validator
```

## Health

**Score 40/100 (D)** — status: abandoned.

Positive: has types; no vulnerabilities; popular repo; extremely popular.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 0.0.34 |
| Published | 2023-11-21 |
| First published | 2016-05-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 51420 |
| Maintainers | types |

## Links

- npm: https://www.npmjs.com/package/@types/node-validator
- Repository: https://github.com/DefinitelyTyped/DefinitelyTyped
- Homepage: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node-validator
- npm.io page: https://npm.io/package/@types/node-validator

## Recent versions

- 0.0.34 (latest) — 2023-11-21
- 0.0.30 (ts3.6) — 2021-07-08
- 0.0.29 (ts2.0) — 2017-01-06
- 0.0.33 — 2023-11-07
- 0.0.32 — 2023-10-18
- 0.0.31 — 2023-09-23
- 0.0.28 — 2016-09-19
- 0.0.27 — 2016-07-14
- 0.0.26-alpha — 2016-07-08
- 0.0.25-alpha — 2016-07-04
- 0.0.24-alpha — 2016-07-02
- 0.0.23-alpha — 2016-07-01
- 0.0.22-alpha — 2016-07-01
- 0.0.21-alpha — 2016-05-25
- 0.0.20-alpha — 2016-05-20
- … 2 more at https://npm.io/package/@types/node-validator/versions

## README

# Installation
> `npm install --save @types/node-validator`

# Summary
This package contains type definitions for node-validator (https://www.npmjs.com/package/node-validator).

# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node-validator.
## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node-validator/index.d.ts)
````ts
declare namespace ValidatorOptions {
    interface IsStringOptions {
        regex?: RegExp | undefined;
        message?: String | undefined;
    }

    interface IsNumberOptions {
        min?: Number | undefined;
        max?: Number | undefined;
    }

    interface IsDateOptions {
        format?: String | undefined;
        message?: String | undefined;
    }

    type Options = IsStringOptions | IsNumberOptions | IsDateOptions;
}

declare namespace Validator {
    type ValidateFn = (value: any, onError: (message: String, childName: String, childValie: any) => void) => void;

    interface Validatable {
        validate: ValidateFn;
    }

    interface IsObjectValidator extends Validatable {
        withRequired: (name: String, validator: Validatable) => IsObjectValidator;
        withOptional: (name: String, validator: Validatable) => IsObjectValidator;
        withCustom: (customValidator: ValidateFn) => IsObjectValidator;
        validate: ValidateFn;
    }

    function express(validator: Validatable): any;
    function bodyValidator(validator: Validatable): any;
    function expressParams(validator: Validatable): any;
    function paramsValidator(validator: Validatable): any;
    function expressQuery(validator: Validatable): any;
    function queryValidator(validator: Validatable): any;

    function run(validator: Validatable, value: any, callback: (errorCount: Number, errors: any[]) => void): void;

    function isObject(): IsObjectValidator;
    function isString(options?: ValidatorOptions.IsStringOptions): Validatable;
    function isStringOrNull(options?: ValidatorOptions.IsStringOptions): Validatable;
    function isBoolean(): Validatable;
    function isNumber(options?: ValidatorOptions.IsNumberOptions): Validatable;
    function isInteger(options?: ValidatorOptions.IsNumberOptions): Validatable;
    function isDate(options?: ValidatorOptions.IsDateOptions): Validatable;
    function isIsoDate(options?: ValidatorOptions.IsDateOptions): Validatable;
    function isIsoDateTime(options?: ValidatorOptions.IsDateOptions): Validatable;

    function isArray(validator?: Validatable, options?: ValidatorOptions.Options): Validatable;
    function isAnyObject(): IsObjectValidator;
}

declare module "node-validator" {
    export = Validator;
}

````

### Additional Details
 * Last updated: Mon, 20 Nov 2023 23:36:24 GMT
 * Dependencies: none

# Credits
These definitions were written by [Ken Gorab](https://github.com/kengorab).

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