Skip to content

Commit

Permalink
README.md.
Browse files Browse the repository at this point in the history
  • Loading branch information
seanmorris committed Aug 25, 2024
1 parent 05eb1b5 commit 7bc2271
Showing 1 changed file with 21 additions and 13 deletions.
34 changes: 21 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,6 @@ You can install libtuple via `npm`:
$ npm install libtuple
```

You can also import directly via [importmaps](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script/type/importmap):

```html
<script type="importmap">
{
"imports": {
"libtuple": "https://cdn.jsdelivr.net/npm/libtuple/index.mjs"
}
}
</script>
```

#### Usage

Simply import the functions from `libtuple`:
Expand All @@ -36,12 +24,32 @@ Simply import the functions from `libtuple`:
import { Tuple, Group, Record, Dict } from 'libtuple';
```

You can also import them via [dynamic imports](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/import):
You can also import them via URL imports, or [dynamic imports](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/import):

```javascript
import {Tuple, Group, Record, Dict } from 'https://cdn.jsdelivr.net/npm/[email protected]/index.mjs';
```

```javascript
const { Tuple, Group, Record, Dict } = await import('https://cdn.jsdelivr.net/npm/libtuple/index.mjs');
```

Alternatively you can add it to your importmap:

```html
<script type="importmap">
{
"imports": {
"libtuple": "https://cdn.jsdelivr.net/npm/libtuple/index.mjs"
}
}
</script>
<script type="module">
import {Tuple, Group, Record, Dict } from 'libtuple';
// ...
</script>
```

### Tuple()

Pass a list of values to the `Tuple()` function. This value will be strictly equivalent to any tuple generated with the same values:
Expand Down

0 comments on commit 7bc2271

Please sign in to comment.