Skip to content

Commit 23ea8aa

Browse files
📚 docs: Add README example and update usage recommendations.
1 parent 8f7d13d commit 23ea8aa

File tree

2 files changed

+12
-17
lines changed

2 files changed

+12
-17
lines changed

README.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,18 @@
44
ArrayLike copying for JavaScript.
55
See [docs](https://array-like.github.io/copy/index.html).
66

7-
> :building_construction: Caveat emptor! This is work in progress. Code may be
8-
> working. Documentation may be present. Coherence may be. Maybe.
7+
```js
8+
import {range} from '@iterable-iterator/range';
9+
const n = 100;
10+
const a = Array.from(range(n))
11+
const ai = 0;
12+
const aj = n;
13+
const b = new Uint8Array(n);
14+
const bi = 0;
915

10-
> :warning: Depending on your environment, the code may require
11-
> `regeneratorRuntime` to be defined, for instance by importing
12-
> [regenerator-runtime/runtime](https://www.npmjs.com/package/regenerator-runtime).
16+
import {copy} from '@array-like/copy';
17+
copy(a, ai, aj, b, bi);
18+
```
1319

1420
[![License](https://img.shields.io/github/license/array-like/copy.svg)](https://raw.githubusercontent.com/array-like/copy/main/LICENSE)
1521
[![Version](https://img.shields.io/npm/v/@array-like/copy.svg)](https://www.npmjs.org/package/@array-like/copy)

doc/manual/usage.md

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,6 @@
11
# Usage
22

3-
> :warning: Depending on your environment, the code may require
4-
> `regeneratorRuntime` to be defined, for instance by importing
5-
> [regenerator-runtime/runtime](https://www.npmjs.com/package/regenerator-runtime).
6-
7-
First, require the polyfill at the entry point of your application
8-
```js
9-
await import('regenerator-runtime/runtime.js');
10-
// or
11-
import 'regenerator-runtime/runtime.js';
12-
```
13-
14-
Then, import the library where needed
3+
Import the library where needed
154
```js
165
const copy = await import('@array-like/copy');
176
// or

0 commit comments

Comments
 (0)