# ow-my-class

> Validate a plain object with a class and make it type-safe!

Latest version **0.1.1** (published 2019-05-31) · MIT license · 0 weekly downloads

## Install

```sh
npm install ow-my-class
pnpm add ow-my-class
yarn add ow-my-class
bun add ow-my-class
```

## 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 | 2019-05-31 |
| First published | 2019-05-31 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 10.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Author | Junyoung Choi |
| Maintainers | rokt33r |
| Keywords | ow, class, object, assert, assertion, is, validate, validation, transformation, serialization, deserialization, util |

## Links

- npm: https://www.npmjs.com/package/ow-my-class
- Repository: https://github.com/BoostIO/ow-my-class
- Issues: https://github.com/BoostIO/ow-my-class/issues
- npm.io page: https://npm.io/package/ow-my-class

## Dependencies (1)

- [type-fest](https://npm.io/package/type-fest.md) ^0.5.2

## Alternatives

- [memory-cache](https://npm.io/package/memory-cache.md) — 795.0K weekly downloads
- [@httptoolkit/proxy-agent](https://npm.io/package/@httptoolkit/proxy-agent.md) — 11.2K weekly downloads
- [express-cache-controller](https://npm.io/package/express-cache-controller.md) — 5.3K weekly downloads
- [http-cache-middleware](https://npm.io/package/http-cache-middleware.md) — 4.5K weekly downloads
- [cache2](https://npm.io/package/cache2.md) — 1.5K weekly downloads

## Recent versions

- 0.1.1 (latest) — 2019-05-31

## README

# `ow-my-class`

Validate a plain object with a class and make it type-safe!

[![Build Status](https://travis-ci.com/BoostIO/ow-my-class.svg?branch=master)](https://travis-ci.com/BoostIO/ow-my-class)
[![codecov](https://codecov.io/gh/BoostIO/ow-my-class/branch/master/graph/badge.svg)](https://codecov.io/gh/BoostIO/ow-my-class)
[![NPM download](https://img.shields.io/npm/dm/ow-my-class.svg)](https://www.npmjs.com/package/prismy)
[![Supported by BoostIO](https://github.com/BoostIO/boostio-materials/raw/master/v1/boostio-shield-v1.svg?sanitize=true)](https://boostio.co)

## Usage

```sh
npm i ow ow-my-class
```

```ts
import Omc from 'ow-my-class'
import ow from 'ow'

class User {
  @Omc(ow.string.minLength(5))
  name: string
}

// Return false
const result = Omc.isValid(
  {
    name: 'yolo'
  },
  User
)

// Throw ValidationError
Omc.validate(
  {
    name: 'yolo'
  },
  User
)

// Transform plain object into User instance
const user = Omc.validate(
  {
    name: 'yolo yolo'
  },
  User
)
```

## License

MIT

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