Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

tiny-types

Package Overview
Dependencies
Maintainers
1
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tiny-types - npm Package Compare versions

Comparing version 1.8.0 to 1.8.1

8

lib/ensure.d.ts

@@ -6,13 +6,13 @@ import { Predicate } from './predicates';

* @example <caption>Basic usage</caption>
* import { check, isDefined } from 'tiny-types'
* import { ensure, isDefined } from 'tiny-types'
*
* const username = 'jan-molak'
* check('Username', username, isDefined());
* ensure('Username', username, isDefined());
*
* @example <caption>Ensuring validity of a domain object upon creation</caption>
* import { TinyType, check, isDefined, isInteger, isInRange } from 'tiny-types'
* import { TinyType, ensure, isDefined, isInteger, isInRange } from 'tiny-types'
*
* class Age extends TinyType {
* constructor(public readonly value: number) {
* check('Age', value, isDefined(), isInteger(), isInRange(0, 125));
* ensure('Age', value, isDefined(), isInteger(), isInRange(0, 125));
* }

@@ -19,0 +19,0 @@ * }

@@ -8,13 +8,13 @@ "use strict";

* @example <caption>Basic usage</caption>
* import { check, isDefined } from 'tiny-types'
* import { ensure, isDefined } from 'tiny-types'
*
* const username = 'jan-molak'
* check('Username', username, isDefined());
* ensure('Username', username, isDefined());
*
* @example <caption>Ensuring validity of a domain object upon creation</caption>
* import { TinyType, check, isDefined, isInteger, isInRange } from 'tiny-types'
* import { TinyType, ensure, isDefined, isInteger, isInRange } from 'tiny-types'
*
* class Age extends TinyType {
* constructor(public readonly value: number) {
* check('Age', value, isDefined(), isInteger(), isInRange(0, 125));
* ensure('Age', value, isDefined(), isInteger(), isInRange(0, 125));
* }

@@ -21,0 +21,0 @@ * }

@@ -6,7 +6,7 @@ import { Predicate } from './Predicate';

* @example
* import { and, check, isDefined, isGreaterThan, isInteger, TinyType } from 'tiny-types';
* import { and, ensure, isDefined, isGreaterThan, isInteger, TinyType } from 'tiny-types';
*
* class AgeInYears extends TinyType {
* constructor(public readonly value: number) {
* check('Percentage', value, and(isDefined(), isInteger(), isGreaterThan(18));
* ensure('Percentage', value, and(isDefined(), isInteger(), isGreaterThan(18));
* }

@@ -13,0 +13,0 @@ * }

@@ -21,7 +21,7 @@ "use strict";

* @example
* import { and, check, isDefined, isGreaterThan, isInteger, TinyType } from 'tiny-types';
* import { and, ensure, isDefined, isGreaterThan, isInteger, TinyType } from 'tiny-types';
*
* class AgeInYears extends TinyType {
* constructor(public readonly value: number) {
* check('Percentage', value, and(isDefined(), isInteger(), isGreaterThan(18));
* ensure('Percentage', value, and(isDefined(), isInteger(), isGreaterThan(18));
* }

@@ -28,0 +28,0 @@ * }

@@ -10,3 +10,3 @@ import { Predicate } from './Predicate';

* @example <caption>Array</caption>
* import { check, hasLengthOf, TinyType } from 'tiny-types';
* import { ensure, hasLengthOf, TinyType } from 'tiny-types';
*

@@ -16,3 +16,3 @@ * class Tuple extends TinyType {

* super();
* check('Tuple', values, hasLengthOf(2));
* ensure('Tuple', values, hasLengthOf(2));
* }

@@ -22,3 +22,3 @@ * }

* @example <caption>String</caption>
* import { check, hasLengthOf, TinyType } from 'tiny-types';
* import { ensure, hasLengthOf, TinyType } from 'tiny-types';
*

@@ -28,3 +28,3 @@ * class Username extends TinyType {

* super();
* check('Username', value, hasLengthOf(8));
* ensure('Username', value, hasLengthOf(8));
* }

@@ -31,0 +31,0 @@ * }

@@ -9,3 +9,3 @@ "use strict";

* @example <caption>Array</caption>
* import { check, hasLengthOf, TinyType } from 'tiny-types';
* import { ensure, hasLengthOf, TinyType } from 'tiny-types';
*

@@ -15,3 +15,3 @@ * class Tuple extends TinyType {

* super();
* check('Tuple', values, hasLengthOf(2));
* ensure('Tuple', values, hasLengthOf(2));
* }

@@ -21,3 +21,3 @@ * }

* @example <caption>String</caption>
* import { check, hasLengthOf, TinyType } from 'tiny-types';
* import { ensure, hasLengthOf, TinyType } from 'tiny-types';
*

@@ -27,3 +27,3 @@ * class Username extends TinyType {

* super();
* check('Username', value, hasLengthOf(8));
* ensure('Username', value, hasLengthOf(8));
* }

@@ -30,0 +30,0 @@ * }

@@ -6,3 +6,3 @@ import { Predicate } from './Predicate';

* @example
* import { check, isArray, TinyType, TinyTypeOf } from 'tiny-types';
* import { ensure, isArray, TinyType, TinyTypeOf } from 'tiny-types';
*

@@ -14,3 +14,3 @@ * class Name extends TinyTypeOf<string>() {}

* super();
* check('Names', values, isArray());
* ensure('Names', values, isArray());
* }

@@ -17,0 +17,0 @@ * }

@@ -8,3 +8,3 @@ "use strict";

* @example
* import { check, isArray, TinyType, TinyTypeOf } from 'tiny-types';
* import { ensure, isArray, TinyType, TinyTypeOf } from 'tiny-types';
*

@@ -16,3 +16,3 @@ * class Name extends TinyTypeOf<string>() {}

* super();
* check('Names', values, isArray());
* ensure('Names', values, isArray());
* }

@@ -19,0 +19,0 @@ * }

@@ -6,7 +6,7 @@ import { Predicate } from './Predicate';

* @example
* import { check, isDefined, TinyType } from 'tiny-types';
* import { ensure, isDefined, TinyType } from 'tiny-types';
*
* class Name extends TinyType {
* constructor(public readonly value: string) {
* check('Name', value, isDefined());
* ensure('Name', value, isDefined());
* }

@@ -13,0 +13,0 @@ * }

@@ -8,7 +8,7 @@ "use strict";

* @example
* import { check, isDefined, TinyType } from 'tiny-types';
* import { ensure, isDefined, TinyType } from 'tiny-types';
*
* class Name extends TinyType {
* constructor(public readonly value: string) {
* check('Name', value, isDefined());
* ensure('Name', value, isDefined());
* }

@@ -15,0 +15,0 @@ * }

@@ -9,3 +9,3 @@ "use strict";

* @example <caption>Comparing Tiny Types</caption>
* import { check, isEqualTo, TinyType, TinyTypeOf } from 'tiny-types';
* import { ensure, isEqualTo, TinyType, TinyTypeOf } from 'tiny-types';
*

@@ -19,3 +19,3 @@ * class AccountId extends TinyTypeOf<number>() {}

* handle(command: Command) {
* check('AccountId', command.value, isEqualTo(this.loggedInUser));
* ensure('AccountId', command.value, isEqualTo(this.loggedInUser));
* }

@@ -25,7 +25,7 @@ * }

* @example <caption>Comparing primitives</caption>
* import { check, isEqualTo, TinyType } from 'tiny-types';
* import { ensure, isEqualTo, TinyType } from 'tiny-types';
*
* class Admin extends TinyType {
* constructor(public readonly id: number) {
* check('Admin::id', id, isEqualTo(1));
* ensure('Admin::id', id, isEqualTo(1));
* }

@@ -32,0 +32,0 @@ * }

@@ -6,7 +6,7 @@ import { Predicate } from './Predicate';

* @example
* import { check, isGreaterThan, TinyType } from 'tiny-types';
* import { ensure, isGreaterThan, TinyType } from 'tiny-types';
*
* class AgeInYears extends TinyType {
* constructor(public readonly value: number) {
* check('Age in years', value, isGreaterThan(0));
* ensure('Age in years', value, isGreaterThan(0));
* }

@@ -13,0 +13,0 @@ * }

@@ -8,7 +8,7 @@ "use strict";

* @example
* import { check, isGreaterThan, TinyType } from 'tiny-types';
* import { ensure, isGreaterThan, TinyType } from 'tiny-types';
*
* class AgeInYears extends TinyType {
* constructor(public readonly value: number) {
* check('Age in years', value, isGreaterThan(0));
* ensure('Age in years', value, isGreaterThan(0));
* }

@@ -15,0 +15,0 @@ * }

@@ -6,7 +6,7 @@ import { Predicate } from './Predicate';

* @example
* import { check, isGreaterThanOrEqualTo, TinyType } from 'tiny-types';
* import { ensure, isGreaterThanOrEqualTo, TinyType } from 'tiny-types';
*
* class AgeInYears extends TinyType {
* constructor(public readonly value: number) {
* check('Age in years', value, isGreaterThanOrEqualTo(18));
* ensure('Age in years', value, isGreaterThanOrEqualTo(18));
* }

@@ -13,0 +13,0 @@ * }

@@ -10,7 +10,7 @@ "use strict";

* @example
* import { check, isGreaterThanOrEqualTo, TinyType } from 'tiny-types';
* import { ensure, isGreaterThanOrEqualTo, TinyType } from 'tiny-types';
*
* class AgeInYears extends TinyType {
* constructor(public readonly value: number) {
* check('Age in years', value, isGreaterThanOrEqualTo(18));
* ensure('Age in years', value, isGreaterThanOrEqualTo(18));
* }

@@ -17,0 +17,0 @@ * }

@@ -6,3 +6,3 @@ import { Predicate } from './Predicate';

* @example
* import { check, isInRange, TinyType } from 'tiny-types';
* import { ensure, isInRange, TinyType } from 'tiny-types';
*

@@ -12,3 +12,3 @@ * class InvestmentLengthInYears extends TinyType {

* super();
* check('InvestmentLengthInYears', value, isInRange(1, 5));
* ensure('InvestmentLengthInYears', value, isInRange(1, 5));
* }

@@ -15,0 +15,0 @@ * }

@@ -10,3 +10,3 @@ "use strict";

* @example
* import { check, isInRange, TinyType } from 'tiny-types';
* import { ensure, isInRange, TinyType } from 'tiny-types';
*

@@ -16,3 +16,3 @@ * class InvestmentLengthInYears extends TinyType {

* super();
* check('InvestmentLengthInYears', value, isInRange(1, 5));
* ensure('InvestmentLengthInYears', value, isInRange(1, 5));
* }

@@ -19,0 +19,0 @@ * }

@@ -6,7 +6,7 @@ import { Predicate } from './Predicate';

* @example
* import { and, isInteger, TinyType } from 'tiny-types';
* import { ensure, isInteger, TinyType } from 'tiny-types';
*
* class AgeInYears extends TinyType {
* constructor(public readonly value: number) {
* check('Age in years', value, isInteger());
* ensure('Age in years', value, isInteger());
* }

@@ -13,0 +13,0 @@ * }

@@ -8,7 +8,7 @@ "use strict";

* @example
* import { and, isInteger, TinyType } from 'tiny-types';
* import { ensure, isInteger, TinyType } from 'tiny-types';
*
* class AgeInYears extends TinyType {
* constructor(public readonly value: number) {
* check('Age in years', value, isInteger());
* ensure('Age in years', value, isInteger());
* }

@@ -15,0 +15,0 @@ * }

@@ -6,7 +6,7 @@ import { Predicate } from './Predicate';

* @example
* import { check, isLessThan, TinyType } from 'tiny-types';
* import { ensure, isLessThan, TinyType } from 'tiny-types';
*
* class InvestmentPeriodInYears extends TinyType {
* constructor(public readonly value: number) {
* check('Investment period in years', value, isLessThan(50));
* ensure('Investment period in years', value, isLessThan(50));
* }

@@ -13,0 +13,0 @@ * }

@@ -8,7 +8,7 @@ "use strict";

* @example
* import { check, isLessThan, TinyType } from 'tiny-types';
* import { ensure, isLessThan, TinyType } from 'tiny-types';
*
* class InvestmentPeriodInYears extends TinyType {
* constructor(public readonly value: number) {
* check('Investment period in years', value, isLessThan(50));
* ensure('Investment period in years', value, isLessThan(50));
* }

@@ -15,0 +15,0 @@ * }

@@ -6,7 +6,7 @@ import { Predicate } from './Predicate';

* @example
* import { check, isLessThanOrEqualTo, TinyType } from 'tiny-types';
* import { ensure, isLessThanOrEqualTo, TinyType } from 'tiny-types';
*
* class InvestmentPeriod extends TinyType {
* constructor(public readonly value: number) {
* check('InvestmentPeriod', value, isLessThanOrEqualTo(50));
* ensure('InvestmentPeriod', value, isLessThanOrEqualTo(50));
* }

@@ -13,0 +13,0 @@ * }

@@ -10,7 +10,7 @@ "use strict";

* @example
* import { check, isLessThanOrEqualTo, TinyType } from 'tiny-types';
* import { ensure, isLessThanOrEqualTo, TinyType } from 'tiny-types';
*
* class InvestmentPeriod extends TinyType {
* constructor(public readonly value: number) {
* check('InvestmentPeriod', value, isLessThanOrEqualTo(50));
* ensure('InvestmentPeriod', value, isLessThanOrEqualTo(50));
* }

@@ -17,0 +17,0 @@ * }

@@ -6,3 +6,3 @@ import { Predicate } from './Predicate';

* @example
* import { check, isOneOf, TinyType } from 'tiny-types';
* import { ensure, isOneOf, TinyType } from 'tiny-types';
*

@@ -13,3 +13,3 @@ * class StreetLight extends TinyType {

*
* check('StreetLight', value, isOneOf('red', 'yellow', 'green'));
* ensure('StreetLight', value, isOneOf('red', 'yellow', 'green'));
* }

@@ -16,0 +16,0 @@ * }

@@ -9,3 +9,3 @@ "use strict";

* @example
* import { check, isOneOf, TinyType } from 'tiny-types';
* import { ensure, isOneOf, TinyType } from 'tiny-types';
*

@@ -16,3 +16,3 @@ * class StreetLight extends TinyType {

*
* check('StreetLight', value, isOneOf('red', 'yellow', 'green'));
* ensure('StreetLight', value, isOneOf('red', 'yellow', 'green'));
* }

@@ -19,0 +19,0 @@ * }

@@ -6,7 +6,7 @@ import { Predicate } from './Predicate';

* @example
* import { check, isEqualTo, isGreaterThan, isLessThan, or } from 'tiny-type'l
* import { ensure, isEqualTo, isGreaterThan, isLessThan, or } from 'tiny-type'l
*
* class Percentage extends TinyType {
* constructor(public readonly value: number) {
* check('Percentage', value, or(isEqualTo(0), isGreaterThan(0)), or(isLessThan(100), isEqualTo(100));
* ensure('Percentage', value, or(isEqualTo(0), isGreaterThan(0)), or(isLessThan(100), isEqualTo(100));
* }

@@ -13,0 +13,0 @@ * }

@@ -21,7 +21,7 @@ "use strict";

* @example
* import { check, isEqualTo, isGreaterThan, isLessThan, or } from 'tiny-type'l
* import { ensure, isEqualTo, isGreaterThan, isLessThan, or } from 'tiny-type'l
*
* class Percentage extends TinyType {
* constructor(public readonly value: number) {
* check('Percentage', value, or(isEqualTo(0), isGreaterThan(0)), or(isLessThan(100), isEqualTo(100));
* ensure('Percentage', value, or(isEqualTo(0), isGreaterThan(0)), or(isLessThan(100), isEqualTo(100));
* }

@@ -28,0 +28,0 @@ * }

@@ -31,3 +31,3 @@ /**

* @example <caption>Assuming we'd like to create an isDefined() predicate:</caption>
* check(`some value`, value, isDefined());
* ensure(`some value`, value, isDefined());
*

@@ -34,0 +34,0 @@ * @example <caption>We can either use the Predicate.to factory method:</caption>

@@ -54,3 +54,3 @@ "use strict";

* @example <caption>Assuming we'd like to create an isDefined() predicate:</caption>
* check(`some value`, value, isDefined());
* ensure(`some value`, value, isDefined());
*

@@ -57,0 +57,0 @@ * @example <caption>We can either use the Predicate.to factory method:</caption>

{
"name": "tiny-types",
"version": "1.8.0",
"version": "1.8.1",
"description": "A tiny library that brings Tiny Types to JavaScript and TypeScript",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -14,2 +14,6 @@ # Tiny Types

## API Docs
API documentation is available at [jan-molak.github.io/tiny-types/](https://jan-molak.github.io/tiny-types/).
## Installation

@@ -16,0 +20,0 @@

@@ -7,13 +7,13 @@ import { and, Failure, isArray, isDefined, isGreaterThan, Predicate } from './predicates';

* @example <caption>Basic usage</caption>
* import { check, isDefined } from 'tiny-types'
* import { ensure, isDefined } from 'tiny-types'
*
* const username = 'jan-molak'
* check('Username', username, isDefined());
* ensure('Username', username, isDefined());
*
* @example <caption>Ensuring validity of a domain object upon creation</caption>
* import { TinyType, check, isDefined, isInteger, isInRange } from 'tiny-types'
* import { TinyType, ensure, isDefined, isInteger, isInRange } from 'tiny-types'
*
* class Age extends TinyType {
* constructor(public readonly value: number) {
* check('Age', value, isDefined(), isInteger(), isInRange(0, 125));
* ensure('Age', value, isDefined(), isInteger(), isInRange(0, 125));
* }

@@ -20,0 +20,0 @@ * }

@@ -10,7 +10,7 @@ import { isArray } from './isArray';

* @example
* import { and, check, isDefined, isGreaterThan, isInteger, TinyType } from 'tiny-types';
* import { and, ensure, isDefined, isGreaterThan, isInteger, TinyType } from 'tiny-types';
*
* class AgeInYears extends TinyType {
* constructor(public readonly value: number) {
* check('Percentage', value, and(isDefined(), isInteger(), isGreaterThan(18));
* ensure('Percentage', value, and(isDefined(), isInteger(), isGreaterThan(18));
* }

@@ -17,0 +17,0 @@ * }

@@ -10,3 +10,3 @@ import { Predicate } from './Predicate';

* @example <caption>Array</caption>
* import { check, hasLengthOf, TinyType } from 'tiny-types';
* import { ensure, hasLengthOf, TinyType } from 'tiny-types';
*

@@ -16,3 +16,3 @@ * class Tuple extends TinyType {

* super();
* check('Tuple', values, hasLengthOf(2));
* ensure('Tuple', values, hasLengthOf(2));
* }

@@ -22,3 +22,3 @@ * }

* @example <caption>String</caption>
* import { check, hasLengthOf, TinyType } from 'tiny-types';
* import { ensure, hasLengthOf, TinyType } from 'tiny-types';
*

@@ -28,3 +28,3 @@ * class Username extends TinyType {

* super();
* check('Username', value, hasLengthOf(8));
* ensure('Username', value, hasLengthOf(8));
* }

@@ -31,0 +31,0 @@ * }

@@ -7,3 +7,3 @@ import { Predicate } from './Predicate';

* @example
* import { check, isArray, TinyType, TinyTypeOf } from 'tiny-types';
* import { ensure, isArray, TinyType, TinyTypeOf } from 'tiny-types';
*

@@ -15,3 +15,3 @@ * class Name extends TinyTypeOf<string>() {}

* super();
* check('Names', values, isArray());
* ensure('Names', values, isArray());
* }

@@ -18,0 +18,0 @@ * }

@@ -7,7 +7,7 @@ import { Predicate } from './Predicate';

* @example
* import { check, isDefined, TinyType } from 'tiny-types';
* import { ensure, isDefined, TinyType } from 'tiny-types';
*
* class Name extends TinyType {
* constructor(public readonly value: string) {
* check('Name', value, isDefined());
* ensure('Name', value, isDefined());
* }

@@ -14,0 +14,0 @@ * }

@@ -12,3 +12,3 @@ import { TinyType } from '../TinyType';

* @example <caption>Comparing Tiny Types</caption>
* import { check, isEqualTo, TinyType, TinyTypeOf } from 'tiny-types';
* import { ensure, isEqualTo, TinyType, TinyTypeOf } from 'tiny-types';
*

@@ -22,3 +22,3 @@ * class AccountId extends TinyTypeOf<number>() {}

* handle(command: Command) {
* check('AccountId', command.value, isEqualTo(this.loggedInUser));
* ensure('AccountId', command.value, isEqualTo(this.loggedInUser));
* }

@@ -28,7 +28,7 @@ * }

* @example <caption>Comparing primitives</caption>
* import { check, isEqualTo, TinyType } from 'tiny-types';
* import { ensure, isEqualTo, TinyType } from 'tiny-types';
*
* class Admin extends TinyType {
* constructor(public readonly id: number) {
* check('Admin::id', id, isEqualTo(1));
* ensure('Admin::id', id, isEqualTo(1));
* }

@@ -35,0 +35,0 @@ * }

@@ -7,7 +7,7 @@ import { Predicate } from './Predicate';

* @example
* import { check, isGreaterThan, TinyType } from 'tiny-types';
* import { ensure, isGreaterThan, TinyType } from 'tiny-types';
*
* class AgeInYears extends TinyType {
* constructor(public readonly value: number) {
* check('Age in years', value, isGreaterThan(0));
* ensure('Age in years', value, isGreaterThan(0));
* }

@@ -14,0 +14,0 @@ * }

@@ -10,7 +10,7 @@ import { isEqualTo } from './isEqualTo';

* @example
* import { check, isGreaterThanOrEqualTo, TinyType } from 'tiny-types';
* import { ensure, isGreaterThanOrEqualTo, TinyType } from 'tiny-types';
*
* class AgeInYears extends TinyType {
* constructor(public readonly value: number) {
* check('Age in years', value, isGreaterThanOrEqualTo(18));
* ensure('Age in years', value, isGreaterThanOrEqualTo(18));
* }

@@ -17,0 +17,0 @@ * }

@@ -10,3 +10,3 @@ import { and } from './and';

* @example
* import { check, isInRange, TinyType } from 'tiny-types';
* import { ensure, isInRange, TinyType } from 'tiny-types';
*

@@ -16,3 +16,3 @@ * class InvestmentLengthInYears extends TinyType {

* super();
* check('InvestmentLengthInYears', value, isInRange(1, 5));
* ensure('InvestmentLengthInYears', value, isInRange(1, 5));
* }

@@ -19,0 +19,0 @@ * }

@@ -7,7 +7,7 @@ import { Predicate } from './Predicate';

* @example
* import { and, isInteger, TinyType } from 'tiny-types';
* import { ensure, isInteger, TinyType } from 'tiny-types';
*
* class AgeInYears extends TinyType {
* constructor(public readonly value: number) {
* check('Age in years', value, isInteger());
* ensure('Age in years', value, isInteger());
* }

@@ -14,0 +14,0 @@ * }

@@ -7,7 +7,7 @@ import { Predicate } from './Predicate';

* @example
* import { check, isLessThan, TinyType } from 'tiny-types';
* import { ensure, isLessThan, TinyType } from 'tiny-types';
*
* class InvestmentPeriodInYears extends TinyType {
* constructor(public readonly value: number) {
* check('Investment period in years', value, isLessThan(50));
* ensure('Investment period in years', value, isLessThan(50));
* }

@@ -14,0 +14,0 @@ * }

@@ -10,7 +10,7 @@ import { isEqualTo } from './isEqualTo';

* @example
* import { check, isLessThanOrEqualTo, TinyType } from 'tiny-types';
* import { ensure, isLessThanOrEqualTo, TinyType } from 'tiny-types';
*
* class InvestmentPeriod extends TinyType {
* constructor(public readonly value: number) {
* check('InvestmentPeriod', value, isLessThanOrEqualTo(50));
* ensure('InvestmentPeriod', value, isLessThanOrEqualTo(50));
* }

@@ -17,0 +17,0 @@ * }

@@ -9,3 +9,3 @@ import { isEqualTo } from './isEqualTo';

* @example
* import { check, isOneOf, TinyType } from 'tiny-types';
* import { ensure, isOneOf, TinyType } from 'tiny-types';
*

@@ -16,3 +16,3 @@ * class StreetLight extends TinyType {

*
* check('StreetLight', value, isOneOf('red', 'yellow', 'green'));
* ensure('StreetLight', value, isOneOf('red', 'yellow', 'green'));
* }

@@ -19,0 +19,0 @@ * }

@@ -10,7 +10,7 @@ import { isArray } from './isArray';

* @example
* import { check, isEqualTo, isGreaterThan, isLessThan, or } from 'tiny-type'l
* import { ensure, isEqualTo, isGreaterThan, isLessThan, or } from 'tiny-type'l
*
* class Percentage extends TinyType {
* constructor(public readonly value: number) {
* check('Percentage', value, or(isEqualTo(0), isGreaterThan(0)), or(isLessThan(100), isEqualTo(100));
* ensure('Percentage', value, or(isEqualTo(0), isGreaterThan(0)), or(isLessThan(100), isEqualTo(100));
* }

@@ -17,0 +17,0 @@ * }

@@ -34,3 +34,3 @@ /**

* @example <caption>Assuming we'd like to create an isDefined() predicate:</caption>
* check(`some value`, value, isDefined());
* ensure(`some value`, value, isDefined());
*

@@ -37,0 +37,0 @@ * @example <caption>We can either use the Predicate.to factory method:</caption>

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc