From 05eb1b53f224b4778752e2660ed73a8b202d6bef Mon Sep 17 00:00:00 2001 From: Sean Morris <640101+seanmorris@users.noreply.github.com> Date: Sun, 25 Aug 2024 17:16:51 -0400 Subject: [PATCH] README.md. --- README.md | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 87ad6a4..0645af0 100644 --- a/README.md +++ b/README.md @@ -4,20 +4,44 @@ [![Test](https://github.com/seanmorris/libtuple/actions/workflows/test.yaml/badge.svg)](https://github.com/seanmorris/libtuple/actions/workflows/test.yaml) -### Install with NPM +### Install & Use + +`libtuple` is now ESM compliant! + +#### npm: + +You can install libtuple via `npm`: ```bash $ npm install libtuple ``` -## Usage +You can also import directly via [importmaps](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script/type/importmap): -`libtuple` is now ESM compliant! +```html + +``` + +#### Usage + +Simply import the functions from `libtuple`: ```javascript 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): + +```javascript +const { Tuple, Group, Record, Dict } = await import('https://cdn.jsdelivr.net/npm/libtuple/index.mjs'); +``` + ### Tuple() Pass a list of values to the `Tuple()` function. This value will be strictly equivalent to any tuple generated with the same values: