1.0.1 • Published 3 years ago

@jcbhmr/assert v1.0.1

Weekly downloads
-
License
-
Repository
-
Last release
3 years ago

assert()

🚫 Dead simple assertion function

import assert from "@jcbhmr/assert"

assert(typeof origin === "string", `Uh oh! Not in a browser!`)

Source code

const assert = (result, message = `Assertion failed`) => {
    if (!result) {
        throw new AssertionError(string)
    }
}
1.0.1

3 years ago