Skip to content

Commit

Permalink
docs: rename 'cleaner creators' as 'configurable cleaners'
Browse files Browse the repository at this point in the history
  • Loading branch information
IlyaSemenov committed Dec 24, 2022
1 parent dc2d434 commit a0f8bb7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
8 changes: 4 additions & 4 deletions packages/data-cleaner-koa/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ It will return cleaned `body` and `files`, and throw a Koa HTTP error response w

## Schema options

The cleaner creator accepts the following schema options:
The cleaner is configured with the following schema options:

- `body`: body cleaner (optional)
- `files`: files cleaner (optional)
Expand Down Expand Up @@ -39,13 +39,13 @@ export default {
async submit() {
this.errors = null
const { data } = await this.$axios.post(
'/register',
new FormData(this.$refs.form),
"/register",
new FormData(this.$refs.form)
)
if (data.errors) {
this.errors = data.errors
} else {
await this.$store.dispatch('login', data.user)
await this.$store.dispatch("login", data.user)
}
},
},
Expand Down
16 changes: 8 additions & 8 deletions packages/data-cleaner/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@ const { clean, ValidationError } = require("data-cleaner")
Terms:

- [Cleaners](#cleaners)
- [Cleaner creators](#cleaner-creators)
- [Configurable cleaners](#configurable-cleaners)

Base cleaners:

- [`clean.any`](#cleanany) (common base for all other creators)
- [`clean.any`](#cleanany) (common base for all other cleaners)

Scalar cleaners:

Expand All @@ -83,7 +83,7 @@ Aggregation cleaners:

### Cleaners

A _cleaner_ is any function that follows the contract:
_Cleaner_ is any function that follows the contract:

```js
function cleaner(value, context) {
Expand All @@ -96,9 +96,9 @@ function cleaner(value, context) {
}
```

### Cleaner creators
### Configurable cleaners

A _cleaner creator_ is a function that creates a _cleaner_ according to the provided schema.
Configurable cleaner is a function that creates a _cleaner_ according to the provided schema.

For example, `clean.string()` creates a cleaner that will accept non-blank strings only, and `clean.string({ blank: true })` creates a cleaner that will accept both blank and non-blank strings.

Expand All @@ -119,7 +119,7 @@ await cleaner(null) // throws "Value required."

#### Schema

All built-in cleaner creators accept schema parameters. For example, you may allow null values with:
All built-in cleaners are configurable and accept schema parameters. For example, you may allow null values with:

```js
const cleaner = clean.any({
Expand All @@ -132,7 +132,7 @@ await cleaner(undefined) // throws "Value required."

##### Accessing original schema

Built-in cleaner creators save schema into `schema` property on the cleaner function:
Built-in cleaners save schema into `schema` property on the cleaner function:

```js
const cleaner = clean.any({
Expand All @@ -144,7 +144,7 @@ cleaner.schema.null // true

#### Common schema options

The following schema parameters are supported by `clean.any()` and by all other built-in cleaner creators.
The following schema parameters are supported by `clean.any()` and by all other built-in cleaners.

- `required: false` - allow undefined values
- `null: true` - allow null values
Expand Down

0 comments on commit a0f8bb7

Please sign in to comment.