From d97524932cc4fb1795072b4f2c1a4be60ea4ee65 Mon Sep 17 00:00:00 2001 From: Bjorn Stromberg Date: Sun, 6 Aug 2023 11:20:15 +0800 Subject: [PATCH] Move Named Exports section close to Usage --- readme.md | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/readme.md b/readme.md index 9be7458..587bdb0 100644 --- a/readme.md +++ b/readme.md @@ -54,6 +54,18 @@ assert.string(foo); // `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 ### 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. -## 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 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.