Skip to content

Commit

Permalink
Comment & typedoc category cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
mbrich committed May 30, 2024
1 parent 7ee8250 commit 320bc50
Show file tree
Hide file tree
Showing 292 changed files with 855 additions and 708 deletions.
66 changes: 66 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,72 @@ Eliminate more edge cases with less code. Automates common type checks and valid

 

# Rules
```typescript
// Create a ruleset using the expected type to be verified
const ruleset = new Ruleset<number>();
// Get a 'value' object from ruleset used to create rules.
const value = ruleset.value();
```


## `lessThan`

```typescript
// Validate whether number input less than 0.
const ruleset = new Ruleset<number>();
const value = ruleset.value();
ruleset.add(value.must.be.lessThan(0));

// Tests input against all rules in ruleset.
const result = await ruleset.verify(-99);
```

```typescript
// Validate whether number input is not less than 0.
const ruleset = new Ruleset<number>();
const value = ruleset.value();
ruleset.add(value.must.not.be.lessThan(0));

// Tests input against all rules in ruleset.
const result = await ruleset.verify(1);
```

## `greaterThan`
```typescript
// Validate whether number input is greater than 100.
const ruleset = new Ruleset<number>();
const value = ruleset.value();
ruleset.add(value.must.be.greaterThan(100));

// Tests input against all rules in ruleset.
const result = await ruleset.verify(20000);
```

## `equalTo`

### `number` values
```typescript
// Validate whether number input is exactly 10.
const ruleset = new Ruleset<number>();
const value = ruleset.value();
ruleset.add(value.must.be.equalTo(10));

// Tests input against all rules in ruleset.
const result = await ruleset.verify(0);
```

### `string` values
```typescript
// Validate whether string input matches 'one'.
const ruleset = new Ruleset<string>();
const value = ruleset.value();
ruleset.add(value.must.be.equalTo('one'));

// Tests input against all rules in ruleset.
const result = await ruleset.verify('valuehere');
```

# Checks
## `verifyArray`
Check that `value` is a valid array.
Expand Down
27 changes: 17 additions & 10 deletions docs/assets/highlight.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,18 @@
--dark-hl-3: #4FC1FF;
--light-hl-4: #795E26;
--dark-hl-4: #DCDCAA;
--light-hl-5: #098658;
--dark-hl-5: #B5CEA8;
--light-hl-6: #267F99;
--dark-hl-6: #4EC9B0;
--light-hl-7: #A31515;
--dark-hl-7: #CE9178;
--light-hl-8: #001080;
--dark-hl-8: #9CDCFE;
--light-hl-9: #000000;
--dark-hl-9: #C8C8C8;
--light-hl-5: #267F99;
--dark-hl-5: #4EC9B0;
--light-hl-6: #001080;
--dark-hl-6: #9CDCFE;
--light-hl-7: #098658;
--dark-hl-7: #B5CEA8;
--light-hl-8: #AF00DB;
--dark-hl-8: #C586C0;
--light-hl-9: #A31515;
--dark-hl-9: #CE9178;
--light-hl-10: #000000;
--dark-hl-10: #C8C8C8;
--light-code-background: #FFFFFF;
--dark-code-background: #1E1E1E;
}
Expand All @@ -34,6 +36,7 @@
--hl-7: var(--light-hl-7);
--hl-8: var(--light-hl-8);
--hl-9: var(--light-hl-9);
--hl-10: var(--light-hl-10);
--code-background: var(--light-code-background);
} }

Expand All @@ -48,6 +51,7 @@
--hl-7: var(--dark-hl-7);
--hl-8: var(--dark-hl-8);
--hl-9: var(--dark-hl-9);
--hl-10: var(--dark-hl-10);
--code-background: var(--dark-code-background);
} }

Expand All @@ -62,6 +66,7 @@
--hl-7: var(--light-hl-7);
--hl-8: var(--light-hl-8);
--hl-9: var(--light-hl-9);
--hl-10: var(--light-hl-10);
--code-background: var(--light-code-background);
}

Expand All @@ -76,6 +81,7 @@
--hl-7: var(--dark-hl-7);
--hl-8: var(--dark-hl-8);
--hl-9: var(--dark-hl-9);
--hl-10: var(--dark-hl-10);
--code-background: var(--dark-code-background);
}

Expand All @@ -89,4 +95,5 @@
.hl-7 { color: var(--hl-7); }
.hl-8 { color: var(--hl-8); }
.hl-9 { color: var(--hl-9); }
.hl-10 { color: var(--hl-10); }
pre, code { background: var(--code-background); }
2 changes: 1 addition & 1 deletion docs/assets/navigation.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/assets/search.js

Large diffs are not rendered by default.

Loading

0 comments on commit 320bc50

Please sign in to comment.