Skip to content
This repository has been archived by the owner on Apr 11, 2024. It is now read-only.

Commit

Permalink
Update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
hugoalh committed Jul 23, 2023
1 parent f2356cb commit 40e2ca5
Showing 1 changed file with 48 additions and 53 deletions.
101 changes: 48 additions & 53 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,56 +89,51 @@ import * as advancedDetermine from "@hugoalh/advanced-determine";// Namespace Im

### Example

```js
/* Either */
new ArrayFilter().test([]);
ArrayFilter.test([]);
filterArray([]);
//=> false (`allowEmpty` is `false`)
```

```js
/* Either */
new ArrayFilter({ allowEmpty: true }).test([]);
new ArrayFilter().allowEmpty().test([]);
ArrayFilter.test([], { allowEmpty: true });
filterArray([], { allowEmpty: true });
//=> true
```

```js
/* Either */
new NumberFilter({ ieee754: "safe", numericType: "float", sign: "positive" }).test(8.31);
new NumberFilter().ieee754("safe").numericType("float").sign("positive").test(8.31);
new NumberFilter().safe().float().positive().test(8.31);
NumberFilter.test(8.31, { ieee754: "safe", numericType: "float", sign: "positive" });
filterNumber(8.31, { ieee754: "safe", numericType: "float", sign: "positive" });
//=> true
```

```js
/* Either */
new StringFilter().test("");
StringFilter.test("");
filterString("");
//=> false (`allowEmpty` is `false`)
```

```js
/* Either */
new StringFilter({ allowEmpty: true }).test("");
new StringFilter().allowEmpty().test("");
StringFilter.test("", { allowEmpty: true });
filterString("", { allowEmpty: true });
//=> true
```

```js
/* Either */
new StringFilter({ case: "lower" }).test("Hello World");
new StringFilter().case("lower").test("Hello World");
new StringFilter().lowerCase().test("Hello World");
StringFilter.test("Hello World", { case: "lower" });
filterString("Hello World", { case: "lower" });
//=> false
```
- ```js
/* Either */
new ArrayFilter().test([]);
ArrayFilter.test([]);
filterArray([]);
//=> false (`allowEmpty` is `false`)
```
- ```js
/* Either */
new ArrayFilter({ allowEmpty: true }).test([]);
new ArrayFilter().allowEmpty().test([]);
ArrayFilter.test([], { allowEmpty: true });
filterArray([], { allowEmpty: true });
//=> true
```
- ```js
/* Either */
new NumberFilter({ ieee754: "safe", numericType: "float", sign: "positive" }).test(8.31);
new NumberFilter().ieee754("safe").numericType("float").sign("positive").test(8.31);
new NumberFilter().safe().float().positive().test(8.31);
NumberFilter.test(8.31, { ieee754: "safe", numericType: "float", sign: "positive" });
filterNumber(8.31, { ieee754: "safe", numericType: "float", sign: "positive" });
//=> true
```
- ```js
/* Either */
new StringFilter().test("");
StringFilter.test("");
filterString("");
//=> false (`allowEmpty` is `false`)
```
- ```js
/* Either */
new StringFilter({ allowEmpty: true }).test("");
new StringFilter().allowEmpty().test("");
StringFilter.test("", { allowEmpty: true });
filterString("", { allowEmpty: true });
//=> true
```
- ```js
/* Either */
new StringFilter({ case: "lower" }).test("Hello World");
new StringFilter().case("lower").test("Hello World");
new StringFilter().lowerCase().test("Hello World");
StringFilter.test("Hello World", { case: "lower" });
filterString("Hello World", { case: "lower" });
//=> false
```

0 comments on commit 40e2ca5

Please sign in to comment.