Skip to content

Commit

Permalink
Fix readme typos (#397)
Browse files Browse the repository at this point in the history
  • Loading branch information
neotan authored Nov 10, 2024
1 parent 9fce3f9 commit 4b92547
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -217,15 +217,15 @@ Parse the value as a boolean type instead of string type if it's a boolean.
Type: `object`\
Default: `{}`

Specify a pre-defined schema to be used when parsing values. The types specified will take precedence over options such as: `parseNumber`, `parseBooleans`, and `arrayFormat`.
Specify a pre-defined schema to be used when parsing values. The types specified will take precedence over options such as: `parseNumbers`, `parseBooleans`, and `arrayFormat`.

Use this feature to override the type of a value. This can be useful when the type is ambiguous such as a phone number.

It is possible to provide a custom function as the parameter type. The parameter's value will equal the function's return value.

Supported Types:

- `'string'`: Parse `phoneNumber` as a string (overriding the `parseNumber` option):
- `'string'`: Parse `phoneNumber` as a string (overriding the `parseNumbers` option):

```js
import queryString from 'query-string';
Expand All @@ -239,7 +239,7 @@ queryString.parse('?phoneNumber=%2B380951234567&id=1', {
//=> {phoneNumber: '+380951234567', id: 1}
```

- `'number'`: Parse `age` as a number (even when `parseNumber` is false):
- `'number'`: Parse `age` as a number (even when `parseNumbers` is false):

```js
import queryString from 'query-string';
Expand All @@ -252,21 +252,21 @@ queryString.parse('?age=20&id=01234&zipcode=90210', {
//=> {age: 20, id: '01234', zipcode: '90210 }
```

- `'string[]'`: Parse `items` as an array of strings (overriding the `parseNumber` option):
- `'string[]'`: Parse `items` as an array of strings (overriding the `parseNumbers` option):

```js
import queryString from 'query-string';

queryString.parse('?age=20&items=1%2C2%2C3', {
parseNumber: true,
parseNumbers: true,
types: {
items: 'string[]',
}
});
//=> {age: 20, items: ['1', '2', '3']}
```

- `'number[]'`: Parse `items` as an array of numbers (even when `parseNumber` is false):
- `'number[]'`: Parse `items` as an array of numbers (even when `parseNumbers` is false):

```js
import queryString from 'query-string';
Expand Down

0 comments on commit 4b92547

Please sign in to comment.