0.3.6 • Published 3 years ago

@vapurrmaid/validate v0.3.6

Weekly downloads
1
License
MIT
Repository
github
Last release
3 years ago

Validate

An incredibly simple, zero-dependency package for writing maintainable, easy-to-read, validation assertions. This package is highly inspired by:

Usage of Validate is an opinionated, stylistic preference. Other options exists - see the example usage to get a feel for how Validate can improve code style.

Example Usage

Without:

class PositiveNumber {
  public readonly value: number;

  constructor(i: number) {
    if (i <= 0) {
      throw new Error(`i must be greater than 0. Instead received ${i}`);
    }
    this.value = i;
  }
}

With:

import { Validate } from '@vapurrmaid/validate';

class PositiveNumber {
  public readonly value: number;

  constructor(i: number) {
    Validate.isTrue(i > 0, `i must be greater than 0. Instead received ${i}`);
    this.value = i;
  }
}
1.0.0-beta.0

3 years ago

0.3.6

3 years ago

0.3.5

3 years ago

0.3.4

4 years ago

0.3.3

4 years ago

0.3.2

4 years ago

0.3.1

4 years ago

0.3.0

4 years ago

0.3.0-beta.1

4 years ago

0.3.0-beta.0

4 years ago

0.2.1

4 years ago

0.2.0

4 years ago

0.1.0

4 years ago

0.1.1

4 years ago

0.1.0-beta.2

4 years ago

0.1.0-beta.1

4 years ago

0.1.0-beta.0

4 years ago