2.0.0 • Published 10 months ago

@eightnineight/expect v2.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

expect

expect checker

Install

npm install @eightnineight/expect

Usage

import { EXPECT } from "@eightnineight/expect";

try {
    EXPECT.TRUE(5 === 3);
    EXPECT.FALSE(5 === 3);
    EXPECT.EQ(5, 3);
    EXPECT.NE(5, 3);
    EXPECT.LT(5, 3);
    EXPECT.LE(5, 3);
    EXPECT.GT(5, 3);
    EXPECT.GE(5, 3);

    EXPECT.TRUE(5 === 3, "ERR_CUSTOM");
    EXPECT.GE(5, 3, "ERR_CUSTOM");
} catch (e) {
    console.log(e);
}

equal to

try {
    // EXPECT.TRUE(5 === 3);
    if (!(5 === 3)) {
        throw "ERR__EXPECT_TRUE";
    }

    // EXPECT.FALSE(5 === 3);
    if (5 === 3) {
        throw "ERR__EXPECT_FALSE";
    }

    // EXPECT.EQ(5, 3);
    if (5 !== 3) {
        throw "ERR__EXPECT_EQ";
    }

    // EXPECT.NE(5, 3);
    if (5 !== 3) {
        throw "ERR__EXPECT_NE";
    }

    // EXPECT.LT(5, 3);
    if (5 >= 3) {
        throw "ERR__EXPECT_LT";
    }

    // EXPECT.LE(5, 3);
    if (5 > 3) {
        throw "ERR__EXPECT_LE";
    }

    // EXPECT_GT(5, 3);
    if (5 <= 3) {
        throw "ERR__EXPECT_GT";
    }

    // EXPECT_GE(5, 3);
    if (5 < 3) {
        throw "ERR__EXPECT_GE";
    }

    // EXPECT.TRUE(5 === 3, "ERR_CUSTOM");
    if (!(5 === 3)) {
        throw "ERR_CUSTOM";
    }

    // EXPECT_GE(5, 3, "ERR_CUSTOM");
    if (5 < 3) {
        throw "ERR_CUSTOM";
    }
} catch (e) {
    console.log(e);
}
2.0.0

10 months ago

1.2.0

10 months ago

1.1.1

10 months ago

1.1.0

10 months ago

1.0.0

10 months ago