-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
05eb1b5
commit 7bc2271
Showing
1 changed file
with
21 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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`: | ||
|
@@ -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: | ||
|