Require Node.js 14, TS 4.7, and move to ESM (#167)

This commit is contained in:
Sindre Sorhus 2022-06-11 17:44:01 +07:00
parent c408f5a268
commit d6fc1ce0fe
8 changed files with 341 additions and 316 deletions

View file

@ -24,7 +24,7 @@ npm install @sindresorhus/is
## Usage
```js
const is = require('@sindresorhus/is');
import is from '@sindresorhus/is';
is('🦄');
//=> 'string'
@ -39,7 +39,7 @@ is.number(6);
[Assertions](#type-assertions) perform the same type checks, but throw an error if the type does not match.
```js
const {assert} = require('@sindresorhus/is');
import {assert} from '@sindresorhus/is';
assert.string(2);
//=> Error: Expected value which is `string`, received value of type `number`.
@ -436,7 +436,7 @@ Returns `true` if `value` is a DOM Element.
Returns `true` if `value` is a Node.js [stream](https://nodejs.org/api/stream.html).
```js
const fs = require('fs');
import fs from 'node:fs';
is.nodeStream(fs.createReadStream('unicorn.png'));
//=> true
@ -447,7 +447,7 @@ is.nodeStream(fs.createReadStream('unicorn.png'));
Returns `true` if `value` is an `Observable`.
```js
const {Observable} = require('rxjs');
import {Observable} from 'rxjs';
is.observable(new Observable());
//=> true