open-index/open-npm huggingface dataset:
npm package: @hugov/browse
Description: run in browser
Author: Hugo Villeneuve
Latest version: 0.2.0

<!-- markdownlint-disable MD004 MD007 MD010 MD041 MD022 MD024 MD032 -->
# browse

*because it should not be so complicated* -
***run code in browser with watch mode and reload***

• [Why](#why) • [How](#how) • [License](#license) •

# Why

* need to just run a file in browser with no side effects (cache and temp files)
* *Parcel CLI* always creates `.parcel-cache` folders, even with `--no-cache`
* *Vite CLI* creates `.parcel-cache` folders
* *Snowpack CLI* serves a whole folder

## How

### Global

Once: `npm i -g @hugov/browse`
Anywhere: `browse pathToMyScript.js`

### Local

Once: `npm i -D @hugov/browse`
Anywhere: `npx browse pathToMyScript.js`

### Limitations

* Only chrome (uses Chrom Launcher and flags)
* no html entry for now (script/modules only)

# License

[MIT](http://www.opensource.org/licenses/MIT) © [Hugo Villeneuve](https://github.com/hville)
npm package: @hugov/byte-views
Description: ArrayBuffer partitions
Author: Hugo Villeneuve
Latest version: 0.1.0

<!-- markdownlint-disable MD004 MD007 MD010 MD041 MD022 MD024 MD032 MD036 -->
# byte-views

*partition an ArrayBuffer into multiple DataViews and/or TypedArrays*

```js
import next from '@hugov/byte-views'
const memory = new ArrayBuffer(16),
      first = next(memory, Uint8Array, 4),  //using first 4 bytes
      second = next(first, Uint16Array, 2), //using next 4 bytes
      last = next(second)                   //Uint16Array on the remaining 8 bytes
```

## Limitations

* no protection against accidental memory overlaps if the buffer or reference is reused

## License

[MIT](http://www.opensource.org/licenses/MIT) © [Hugo Villeneuve](https://github.com/hville)
npm package: @hugov/cjs-to-iife
Description: small simple bundler
Author: Hugo Villeneuve
Latest version: 0.1.4

# cjs-to-iife

*small simple bundler*

## Examples

```javascript
const code = require('cjs-to-iife')('./commonjsmodule.js')
```

## Notes

* returns the promise of a string
* sets `this.exports.name` or `this.exports.default`. Uses the following rollup options
  * format: 'iife'
  * extend: true
  * exports: 'named'
  * name: 'exports'

## License

[MIT](http://www.opensource.org/licenses/MIT) © [Hugo Villeneuve](https://github.com/hville)
npm package: @hugov/correl-range
Description: monte carlo simulation for correlated variables expressed as ranges
Author: Hugo Villeneuve
Latest version: 0.11.0

<!-- markdownlint-disable MD004 MD007 MD010 MD041 MD022 MD024 MD029 MD031 MD032 MD036 -->
# correl-range

*correlated variable monte carlo simulations*

• [Example](#example) • [API](#api) • [Notes](#notes) • [License](#license)

## Example

```javascript
import SIM from '../sim.js'

const stats = SIM(
({N,L,W,U})=>{
// initiation ran once
const fixed$ = L(500_000, 650_000, 'demand', 0.5, 'price'),
			month$ = L(5_000, 7_000, 'demand', 0.5, 'season', 0.5),
			months = L(6, 9, 'season', 0.5, 'price', -0.5)
return ()=>{
// calculations on every iterations
const total$ = fixed$ + month$ * months
return {
// exported results
	months,
	total$
}}}
).run(10_000).stats

console.log('total$ range', stats.total$.Q(0.25).toFixed(0), stats.total$.Q(0.75).toFixed(0))
console.log('correlation', stats.total$.cor('months'))
```

## API

### sim( factory, {confidence=0.5, resolution=128} ).run( N=25_000 ) ⇒ simulation

* *factory*: `({N, L, G, W, U, D}) => model` where N, L, ... *randomVariableFactory*
* *randomVariableFactory*: `(low, high, ...correlation) => randomVariable` to match the simulation confidence interval
  * N: normal
  * L: lognormal
  * G: gumbell
  * W: weibull
  * U: uniform
  * D: dagum
* *randomVariable*: with `.valueOf()` that changes on each iteration
* *simulation*
  * *stats*: empirical distribution cdf, pdf, quantiles, average (based on modules `sample-distribution` and `lazy-stats`)

## Notes
1. use case is human approximation in decision making - "guesstimates"
2. default is to use a confidence interval of 50% (IQR)
  * familiarity with box plots
  * minimizes overconfidence
  * 50% is also conservative approximation of the median min and max of 3 occurences (`2^(1-1/n)-1=59%` for n=3). This is in line with studies showing ~50% confidence range when asked to provide ~60% confidence. Actual overconfidence varies between studies but is always present.
3. variables can be correlated with independent risk factors by providing the linear factor
4. to maintain correlation, each variable returns a single value per cycle - random variables are constant within a given cycle

# License

[MIT](http://www.opensource.org/licenses/MIT) © [Hugo Villeneuve](https://github.com/hville)
npm package: @hugov/correl-range2
Description: monte carlo simulation for correlated variables expressed as ranges
Author: Hugo Villeneuve
Latest version: 0.2.1

<!-- markdownlint-disable MD004 MD007 MD010 MD041 MD022 MD024 MD029 MD031 MD032 MD036 -->
# correl-range2

*correlated variable monte carlo simulations*

• [Example](#example) • [API](#api) • [Notes](#notes) • [License](#license)

## Example

```javascript
import SIM from '../sim.js'

const res = SIM(
(_,
// initiation ran once
fixed$ = _`600_000 900_000 [0 demand:0.6 price:0.3`,
month$ = _`5,000 7,000 demand:0.5 season:0.5`,
months = _`6 9 [1 season:0.5 price:-0.5`
)=>(
// calculations on every iterations
total$ = fixed$ + month$ * months
)=>({
// exported results
months,
month$,
total$
})
).run(10_000)

//console.log(res.buffer)
const stats=res.stats
console.log('total$ range', stats.total$.Q(0.1).toFixed(0), stats.total$.Q(0.9).toFixed(0))
console.log('correlation', stats.total$.cor('months'))
```

## API

### sim( factory, {confidence=0.8, resolution=128} ).run( N=25_000 ) ⇒ simulation

* *factory*: `randomVariableFactory => model`
* *randomVariableFactory*: taggedTemplate`low high [min med max] {riskName:40%}, ...correlation)` => `randomVariable` to match the simulation confidence interval. The string is parsed to match the `metanorm` arguments
* *randomVariable*: with `.valueOf()` that changes on each iteration
* *simulation*
  * *stats*: empirical distribution cdf, pdf, quantiles, average (based on modules `sample-distribution` and `lazy-stats`)

## Notes
1. use case is human approximation in decision making - "guesstimates"
2. default is to use a confidence interval of 80%
3. variables can be correlated with independent risk factors by providing the linear factor
4. to maintain correlation, each variable returns a single value per cycle - random variables are constant within a given cycle

# License

[MIT](http://www.opensource.org/licenses/MIT) © [Hugo Villeneuve](https://github.com/hville)
npm package: @hugov/inhtml
Description: small and simple in-html templates, factories and dynamic lists
Author: Hugo Villeneuve
Latest version: 1.0.0

<!-- markdownlint-disable MD004 MD007 MD010 MD041 MD022 MD024 MD032 MD036 -->
# inHTML

*small and simple in-html templates, factories and dynamic lists*

• [Features](#features) • [Limitations](#limitations) • [API](#api) • [License](#license)

```html
<table><tbody></tbody></table>
<template>
	<tr id=row>
		<td id=cell></td>
		<td><a id=label></a></td>
	</tr>
</template>
<script type=module>
	import {cast, list} from '@hugov/inhtml'
	const makeRow = cast('template', ({row, cell, label},v,k) => {
		label.textContent = v.ms
		cell.textContent = v.id
		row.update = v => label.textContent = v.ms
		return row
	})
	const tbody = list($('tbody'), makeRow)
	const data = [ {id:'1', ms:'one'} ]
	tbody.update(data)
	data.push( {id:'2', ms:'two'} )
	tbody.update(data)
</script>
```

## Features

* template inside html markup
* no new html constructs. `id` attributes inside the template are stripped and passed on as reference to the decorator function
* template can be a `<template>` element or any other node
* template is cloned, never modified, id attributes are used as references
* multiple dynamic lists within the same parent

## Limitations

* strictly DOM element creation and manipulations (no router, no store)
* browsers only

## API

* `cast( source, decorator ) => nodeFactory`
  * source: node or selector
  * decorator: (ids, ...args) => node|void, ids are striped from the clone's :id attribute
  * nodeFactory: (,,,args) => decorated clone
* `list( parent, childFactory, options) => parent`
  * adds parent.update(value, key) method to the parent

## Helper functions and utils

* tag`text` => `text`
* $(selector, parent=document) | $`selector` : `querySelector` shortcut
* $$(selector, parent=document) | $$`selector` : `querySelectorAll` shortcut
* html(markup) | html`markup` => DocumentFragment
* load(path) => DocumentFragment
* frame(lambda, {context}) => sandboxed AsyncFunction
* worker(code) => Worker

## License

[MIT](http://www.opensource.org/licenses/MIT) © [Hugo Villeneuve](https://github.com/hville)
npm package: @hugov/metanorm
Description: random number generator for specified confidence interval
Author: Hugo Villeneuve
Latest version: 0.5.2

<!-- markdownlint-disable MD036 MD041 -->

# metanorm

*random number generator for specified confidence interval, median and bounds*
**note that this uses a gaussian Z as seed and not the usual uniform U to facilitate the generation of correlated variables**

• [Example](#example) • [API](#api) • [License](#license)

## Example

```javascript
import {default as meta, parse} from './index.js'

const a = meta(1, 4, {ci:0.5})(),        // normal distribution with 50% of values between 1 and 4
      b = parse`1 4 @50%`,                // same as above
      c = meta(1, 4, {min:0}, 0.9)(),    // lognormal distribution with 90% of values between 1 and 4 (lower bound at 0)
      d = parse`[0 1 4 @.9`               // same as above
      e = meta(1, 2, 4)(),               // an unbounded skewed infinite distribution with a median at 2
      f = parse`1 2 4`(),                 // same as above
      g = parse`[0 10% 90% 1]`            // distribution 'close' to a uniform distribution
```

## API

Arguments                         | Returns              | Notes
:--------                         | :------              | :----
`...points [,{min, max, ci=.8}]`  | `rndNumberGenerator` | 0 to 3 points

Arguments            | Notes
 :--------           | :----
 `[min]`             | Optional, a lower bound
 `[max]              | Optional, an upper bound
 `[ci=0.8]           | Optional, The confidence interval, defaults to 80%

Returned Function       | Arguments       | Returns  | Notes
:----------------       | :--------       | :------  | :----
`rndNumberGenerator`    | `[zSeed]`       | `Number` | Random number

Where `zSeed` is an optional unit normal distribution number

# License

[MIT](http://www.opensource.org/licenses/MIT) © [Hugo Villeneuve](https://github.com/hville)
npm package: @hugov/stats
Description: average, standard deviation, variance, covariance and correlation of data sets
Author: Hugo Villeneuve
Latest version: 0.0.1

<!-- markdownlint-disable MD004 MD007 MD010 MD041 MD022 MD024 MD032 MD036 -->
# @hugov/stats

*average, standard deviation, variance, covariance and correlation of data sets*

• [Example](#Example) • [License](#license)

# Example

```javascript
import stats from '@hugov/stats'
const data = { a:[1,2,3], b:[0,1,2] },
      info = stats(data),
      ave_ = info.ave(),        // { a:2, b:1 }
      aveA = info.ave('a'),     // 2
      dev_ = info.dev(),        // { a:1, b:1 }
      devA = info.dev('a'),     // 1
      var_ = info.var(),        // { a:1, b:1 }
      varA = info.var('a'),     // 1
      cov_ = info.cov(),        // {a:{a:1, b:1}, b:{a:1, b:1}}
	    covA = info.cov('a'),     // {a:1, b:1}
	    cvBA = info.cov('b', 'a'),// 1
	    cor_ = info.cor(),        // {a:{a:1, b:1}, b:{a:1, b:1}}
	    corA = info.cor('a'),     // {a:1, b:1}
	    crBA = info.cor('b', 'a') // 1
```

# License

Released under the [MIT License](http://www.opensource.org/licenses/MIT)
npm package: @hugov/sum
Description: kahan compensated sum of array with optional map function
Author: Hugo Villeneuve
Latest version: 1.0.0

<!-- markdownlint-disable MD004 MD007 MD010 MD041 MD022 MD024 MD032 MD036 -->
# @hugov/sum

*small standalone kahan compensated sum with optional map function*

• [Example](#Example) • [License](#license)

# Example

```javascript
import sum from '@hugov/sum'
const array = [1,2,3],
      total = sum(array),
      hypot = Math.sqrt( sum(array, v=>v*v ) )
```

# License

Released under the [MIT License](http://www.opensource.org/licenses/MIT)
npm package: @hugov/test-server
Description: static files and in-memory dev server
Author: Hugo Villeneuve
Latest version: 0.0.4

# puppet-call

*puppeteer helpers for testing*

## API

* `server(serverOptions, serverAction): Promise`
  * `serverAction({host, port, root, origin}):Promise`
  * `serverOptions: {root: string, port: number, routes: Object: host: string}`
  * Initiates a server, evaluate `serverAction`, then closes the server before returning the `serverAction` result

## License

[MIT](http://www.opensource.org/licenses/MIT) © [Hugo Villeneuve](https://github.com/hville)
npm package: @hugov/unnode
Description: bundle imported node_modules
Author: hv
Latest version: 0.1.0

<!-- markdownlint-disable MD004 MD007 MD010 MD041 MD022 MD024 MD029 MD031 MD032 MD036 -->
# @hugov/unnode

*minimal bundling for near unbundled web development*

• [Example](#example) • [Goals](#goals) • [License](#license)

## Example

```javascript
// import bundled files from /webmodules and ./webmodules
import a from '/webmodules/moduleName.js'       // import a from 'moduleName' in node
import b from '/webmodules/moduleName/index.js' // import b from 'moduleName' in node
import('./web_modules/moduleName/src/util.js')   // import ('moduleName/src/util.js') in node
```

```sh
##     target dir  chain of esbuild options
unnode web_modules minify sourcemap=true  # will bundle all references starting with /webmodules
```

## Notes
- used for static site where the source code is served unbundled, as is (e.g. GH pages)
- source html and js files are never changed and can be served as-is
- only bundle node_modules that are requested in the source files
- bundle once, even if imported multiple times
- local ./bundles or shared /bundles
- import bare modules `myModule.js` or parts of a module `myModule/src/util.js`
- esbuild build options

see [schem.ist](schem.ist) source code for example use

# License

[MIT](http://www.opensource.org/licenses/MIT) © [Hugo Villeneuve](https://github.com/hville)
npm package: @hugovhs/grapesjs-bootstrap
Description: Bootstrap components for GrapesJS
Author: hugovhs
Latest version: 0.1.1

# hugovhs Grapesjs Bootstrap 5

## Download

* NPM
  * `npm i @hugovhs/grapesjs-bootstrap`
* GIT
  * `git clone https://github.com/hugovhs/grapesjs-bootstrap.git`

## Usage

Directly in the browser
```html
<link href="https://unpkg.com/grapesjs/dist/css/grapes.min.css" rel="stylesheet"/>
<script src="https://unpkg.com/grapesjs"></script>
<script src="path/to/grapesjs-bootstrap/index.umd.js"></script>

<div id="gjs"></div>

<script type="text/javascript">
  var editor = grapesjs.init({
      container: '#gjs',
      // ...
      plugins: ['grapesjs-bootstrap']
      // ...
  });
</script>
```

JavaScript
```js
import grapesjs from 'grapesjs';
import grapesjsBootstrap from '@hugovhs/grapesjs-bootstrap';

const editor = grapesjs.init({
  container : '#gjs',
  // ...
  plugins: [grapesjsBootstrap],
  // ...
});
```

## License

MIT