Invalid

Monster.Constraints. Invalid

Constraints are used to define conditions that must be met by the value of a variable.

The uniform API of the constraints allows chains to be formed.

The invalid constraint allows an always invalid query to be performed. this constraint is mainly intended for testing.

You can call the method via the monster namespace new Monster.Constraint.Invalid().

<script type="module">
import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.0/dist/monster.js';
new Monster.Constraint.Invalid();
</script>

Alternatively, you can also integrate this function individually.

<script type="module">
import {Invalid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.0/dist/modules/constraints/invalid.js';
new Invalid();
</script>

Constructor

# new Invalid()

A constraint that always invalid

Since:
  • 1.3.0
Example
import {Invalid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.0/dist/modules/constraints/invalid.js';

new Invalid().isValid()
.then(()=>console.log(true))
.catch(()=>console.log(false));
// ↦ false

Methods

# isValid(value) → {Promise}

this method return a rejected promise

Parameters:
Name Type Description
value *
Returns:
Type
Promise