README
@hugojosefson/highland
This is meant to be a (hopefully) proper esmodule re-export of Highland.js, loaded via skypack.dev, for use in a modern web browser or Deno.
Installation
No install. Use it directly from your module script on a web page, or with Deno.
Usage
Simply import
this module from a script module, running inside a web
browser or Deno:
https://cdn.skypack.dev/@hugojosefson/highland?dts
To be certain of which version you use, specify the exact version in the URL:
https://cdn.skypack.dev/@hugojosefson/highland@2.13.5-3?dts
For a better cache experience (1 year vs 5 minutes) in production, you can open the import URL in a web browser, to see what that version's pinned URL is. Then use that instead.
Usage example
Deno
Put this in a file mymodule.ts
:
import _ from 'https://cdn.skypack.dev/@hugojosefson/highland@2.13.5-3?dts'
import { isString } from 'https://cdn.skypack.dev/@hugojosefson/highland@2.13.5-3?dts'
_([1, 2, 'three', 'four'])
.map(n => ({n, numeric: !isString(n)}))
.map(JSON.stringify)
.collect()
.map(array => array.join('\n'))
.each(s => console.log(s))
Run it with Deno:
deno run mymodule.ts
You should see something like this:
{ "n": 1, "numeric": true }
{ "n": 2, "numeric": true }
{ "n": "three", "numeric": false }
{ "n": "four", "numeric": false }
Web browser
Put this in a file named index.html
:
<script type="module" src="./mymodule.mjs"></script>
Put this in mymodule.mjs
, in the same directory as index.html
:
import _ from 'https://cdn.skypack.dev/@hugojosefson/highland@2.13.5-3?dts'
import { isString } from 'https://cdn.skypack.dev/@hugojosefson/highland@2.13.5-3?dts'
_([1, 2, 'three', 'four'])
.map(n => ({n, numeric: !isString(n)}))
.map(JSON.stringify)
.collect()
.map(array => array.join('\n'))
.each(s => document.body.innerText = s)
Serve both files over HTTP (or HTTPS):
npx serve
Browse to the URL provided by serve
, probably
http://localhost:5000/. Or cheat and just go
to
https://raw.githack.com/hugojosefson/highland/main/example-page.html!
You should see something like this:
{ "n": 1, "numeric": true }
{ "n": 2, "numeric": true }
{ "n": "three", "numeric": false }
{ "n": "four", "numeric": false }
This should work directly in any modern browser (because they support esmodules).