# is-in-correct-format

> Allows you to check whether a given object is in the correct specified format.

Latest version **0.1.1** (published 2016-09-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install is-in-correct-format
pnpm add is-in-correct-format
yarn add is-in-correct-format
bun add is-in-correct-format
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.1 |
| Published | 2016-09-07 |
| First published | 2016-09-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=4 |
| Dependencies | 8 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Nick The Sick |
| Maintainers | nperez0111 |

## Links

- npm: https://www.npmjs.com/package/is-in-correct-format
- Repository: https://github.com/nperez0111/is-in-correct-format
- Homepage: https://github.com/nperez0111/is-in-correct-format#readme
- Issues: https://github.com/nperez0111/is-in-correct-format/issues
- npm.io page: https://npm.io/package/is-in-correct-format

## Dependencies (8)

- [is-regex](https://npm.io/package/is-regex.md) ^1.0.3
- [is-buffer](https://npm.io/package/is-buffer.md) ^1.1.4
- [is-number](https://npm.io/package/is-number.md) ^2.1.0
- [is-object](https://npm.io/package/is-object.md) ^1.0.1
- [is-string](https://npm.io/package/is-string.md) ^1.0.4
- [is-symbol](https://npm.io/package/is-symbol.md) ^1.0.1
- [is-promise](https://npm.io/package/is-promise.md) ^2.1.0
- [is-function](https://npm.io/package/is-function.md) ^1.0.1

## Recent versions

- 0.1.1 (latest) — 2016-09-07
- 0.1.0 — 2016-09-07
- 0.0.3 — 2016-09-07
- 0.0.2 — 2016-09-07
- 0.0.1 — 2016-09-06

## README

# is-in-correct-format [![Build Status](https://travis-ci.org/nperez0111/is-in-correct-format.svg?branch=master)](https://travis-ci.org/nperez0111/is-in-correct-format)

> Allows you to check whether a given object is in the correct specified format.


## Install

```
$ npm install --save is-in-correct-format
```


## Usage

```js
const isInCorrectFormat = require('is-in-correct-format');
const is = isInCorrectFormat.is;

isInCorrectFormat( {
	a:2
 },
 {
 	a: is.number
 });
//=> true

isInCorrectFormat( {
	a:{
    	b: 3,
        c: 24
    }
 },
 {
 	a: {
    	b: is.number
    }
 },is.number);
//=> true

isInCorrectFormat( {
	a:{
    	b: 3,
        c: [1,2,3]
    }
 },
 {
 	a: {
    	b: is.number
    }
 },is.number);
//=> true because the arrays values all satisfy 'is.number'
```


## API

### isInCorrectFormat(input, check, [allValues])

#### input

Type: `Object`<br>
Description: The object being checked whether is in the correct type

Cyclical objects are not allowed.

#### check

Type: `Object`<br>
Description: Follows the same format as the input object to check whether the given keys are passing the tests specified.

```js
{
	a: is.function,
	b: function( val ) { 
		return val > 10
    },
    c: val => is.function(val) || is.object(val)
}
```

These are all examples of possibilities in the check object, you can use the helper object `is` to assist in checking type or define your own checker functions and arrow functions.

#### allValues
Type: `Function`
Description: Will be calculated on all values of `input` object regardless of whether they show in the checked object or not.

### isInCorrectFormat.is

#### number
Returns `true` if argument is a `Number`
#### string
Returns `true` if argument is a `String`
#### function
Returns `true` if argument is a `function`
#### boolean
Returns `true` if argument is `true or false`
#### true
Returns `true` if argument is `true`
#### false
Returns `true` if argument is a `false`
#### array
Returns `true` if argument is an `Array`
#### object
Returns `true` if argument is an `Object`
#### undefined
Returns `true` if argument is `undefined`
#### null
Returns `true` if argument is `null`
#### promise
Returns `true` if argument is a `Promise`
#### buffer
Returns `true` if argument is a `Buffer`
#### regex
Returns `true` if argument is a `Regex`
#### symbol
Returns `true` if argument is a `Symbol`


## License

MIT © [Nick The Sick](http://nickthesick.com)

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