Move Named Exports section close to Usage
This commit is contained in:
parent
76303b8a3a
commit
d97524932c
1 changed files with 12 additions and 12 deletions
24
readme.md
24
readme.md
|
|
@ -54,6 +54,18 @@ assert.string(foo);
|
||||||
// `foo` is now typed as a `string`.
|
// `foo` is now typed as a `string`.
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Named Exports
|
||||||
|
|
||||||
|
Named exports allow tooling to perform tree-shaking, potentially reducing bundle size by including only code from the methods that are used.
|
||||||
|
|
||||||
|
Every method listed above is available as a named export. Each method is prefixed by either `is` or `assert` depending on usage.
|
||||||
|
|
||||||
|
For example:
|
||||||
|
|
||||||
|
```js
|
||||||
|
import {assertNull, isUndefined} from '@sindresorhus/is';
|
||||||
|
```
|
||||||
|
|
||||||
## API
|
## API
|
||||||
|
|
||||||
### is(value)
|
### is(value)
|
||||||
|
|
@ -572,18 +584,6 @@ This can be useful to confirm that a value is a valid count of something, ie. 0
|
||||||
|
|
||||||
Returns `true` if the value is a string with only whitespace characters.
|
Returns `true` if the value is a string with only whitespace characters.
|
||||||
|
|
||||||
## Named Exports
|
|
||||||
|
|
||||||
Named exports allow tooling to perform tree-shaking, potentially reducing bundle size by including only code from the methods that are used.
|
|
||||||
|
|
||||||
Every method listed above is available as a named export. Each method is prefixed by either `is` or `assert` depending on usage.
|
|
||||||
|
|
||||||
For example:
|
|
||||||
|
|
||||||
```js
|
|
||||||
import {assertNull, isUndefined} from '@sindresorhus/is';
|
|
||||||
```
|
|
||||||
|
|
||||||
## Type guards
|
## Type guards
|
||||||
|
|
||||||
When using `is` together with TypeScript, [type guards](http://www.typescriptlang.org/docs/handbook/advanced-types.html#type-guards-and-differentiating-types) are being used extensively to infer the correct type inside if-else statements.
|
When using `is` together with TypeScript, [type guards](http://www.typescriptlang.org/docs/handbook/advanced-types.html#type-guards-and-differentiating-types) are being used extensively to infer the correct type inside if-else statements.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue