Skip to content

Commit

Permalink
README.md expand import examples
Browse files Browse the repository at this point in the history
  • Loading branch information
mb21 committed May 7, 2024
1 parent 66823db commit d4364dd
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ npm install --save es-iterator-helpers

## Usage/Examples

Using explicit imports:

```js
const map = require('es-iterator-helpers/Iterator.prototype.map');
const toArray = require('es-iterator-helpers/Iterator.prototype.toArray');
Expand All @@ -67,10 +69,20 @@ assert.deepEqual(
);
```

Shim using `require`:

```js
require('es-iterator-helpers/auto'); // shim all of the methods

require('es-iterator-helpers/Iterator.prototype.map/auto'); // shim the “map” method
```

Shim using `import` syntax:

```js
require('./auto'); // shim all of the methods
import 'es-iterator-helpers/auto'; // shim all of the methods

require('./Iterator.prototype.map/auto'); // shim the “map” method
import 'es-iterator-helpers/Iterator.prototype.map/auto'; // shim the “map” method
```

## Tests
Expand Down

0 comments on commit d4364dd

Please sign in to comment.