Skip to content
This repository was archived by the owner on Mar 22, 2022. It is now read-only.

Latest commit

 

History

History
40 lines (32 loc) · 787 Bytes

File metadata and controls

40 lines (32 loc) · 787 Bytes

Abolish for browser

To use abolish directly in your browser without package managers.

From CDN

<script src="https://cdn.jsdelivr.net/npm/abolish-browser/abolish.min.js"></script>

Abolish is exposed as window.Abolish while Rule is exposed as window.AbolishRule ParseRules is exposed as window.AbolishParseRules

<script>
    const form = {
        age: 10
    };

    const rules = {
        age: 'max:5'
    };

    console.log(Abolish.validate(form, rules))
</script>
{
  "error": {
    "key": "age",
    "type": "validator",
    "validator": "max",
    "message": "Age is too big. (Max. 5)",
    "data": null
  }
}

visit abolish documentation