open-index/open-npm huggingface dataset:
npm package: @lakamark/modulo-editor
Description: Modular, extensible and safe Markdown editor with plugin API and textarea form integration.
Author: Marc-Antoine Lacasse
Latest version: 0.2.0-alpha.1

# ModuloEditor
Modular Markdown editor with plugins and textarea support.

> ⚠️ This project is in early alpha. The API is not stable yet. Do not use in production.

## Features (planned)
- Modular architecture
- Plugin API
- Interchangeable editor input
- Interchangeable preview output
- Safe HTML rendering
- Textarea form integration
- Toolbar extensions
- Command system

## HTML structure
```html
<div class="mo-editor" data-mo-editor>
    <!-- Header editor -->
    <div class="mo-editor__header" data-mo-editor-header>
        <div class="mo-editor__toolbar" data-mo-editor-toolbar></div>
    </div>
    
    <!-- Body editor -->
    <div class="mo-editor__body" data-mo-editor-body>
        <div class="mo-editor__input" data-mo-editor-input></div>
        <div class="mo-editor__preview" data-mo-editor-preview></div>
    </div>
    
    <!-- Footer editor -->
    <div class="mo-editor__footer" data-mo-editor-footer>
        <div class="mo-editor__status" data-mo-editor-status></div>
    </div>
    
    <!-- Hidden textarea for a classic form submitted -->
    <textarea id="content" name="content" hidden data-mo-editor-textarea></textarea>
</div>
```

## Goals
ModuloEditor is designed to be:
* extensible
* framework-agnostic
* safe by default
* plugin driven
* form friendly
* TypeScript first

## Development

Install dependencies
```bash
npm install
```
## Run the playground
```bash
npm run dev
```

## Run tests
```bash
npm run test
```
## Run test in watch mode
```bash
npm run test:watch
```

## Status
Early development — core architecture in progress.

## License
MIT
npm package: @lakca/async-flow
Description: Call functions in different synchronous flow(tick/phase).
Author: lakca
Latest version: 1.0.1


# async-flow

> Call functions in different synchronous flow(tick/phase).

## Usage

```js
// preparation codes

let count = 0
function log() {
    return console.log.bind(console, ++count)
}
const asyncFlow = require('@lakca/async-flow')
const { Flows } = asyncFlow
```

(default) `asyncFor = setTimeout`

```js
asyncFlow(log)(log)(log)

log()

setTimeout(log)
// output: 1, 4, 2, 5, 3
```

`asyncFor = process.nextTick`

```js
asyncFlow(log, process.nextTick)(log)(log)

log()

asyncFor(log)
// output: 1, 4, 2, 5, 3
```

Alternative

```js
const flows = new Flows()
flows.push(log)
flows.push(log)
flows.push(log)
log()
setTimeout(log)
// output: 1, 4, 2, 5, 3
```

## Example

```js
asyncFlow(() => {
    // create and place element in a flex flow.
})(() => {
    // * rendering dom has been executed at the between.
    // calculate the element layout and do related things.
})
```
npm package: @lakca/decent-unit
Description: Decent conversion of measurement units.
Author: lakca
Latest version: 1.0.0

# decent-unit

Decent conversion of measurement units.

[![Build Status](https://travis-ci.org/lakca/decent-unit.svg?branch=master)](https://travis-ci.org/lakca/decent-unit)
[![codecov](https://codecov.io/gh/lakca/decent-unit/branch/master/graph/badge.svg)](https://codecov.io/gh/lakca/decent-unit)

## Usage

```js
const decentUnit = require('@lakca/decent-unit')
```

## Example

```js
decentUnit(2 * 1024 ** 3) // decent result: { value: 2, unit: 'G' }

decentUnit(2 * 1024 ** 3, { fromUnit: 'G' }) // decent result: { value: 2, unit: 'E' }

decentUnit(2 * 1000 ** 3, { fromUnit: 'G', radix: 1000 }) // decent result { value: 2, unit: 'E' }

decentUnit(20000, { fromUnit: '', radix: [100, 20, 10, 2], units: ['', 'K', 'M', 'G', 'T'] }) // decent result { value: 1, unit: 'G' }
 *

decentUnit(2 * 1024 ** 3, { fromUnit: 'G', toUnit: 'P' }) // expected result { value: 2048, unit: 'P' }
```

More in [test](test/main.js).

## API

### `decentUnit(num: number, options?: object)`

#### `{T} [options.fromUnit='']`

> unit of `num`.

#### `{T} [options.toUnit]`

> target unit.

#### `{number|number[]} [options.radix=1024]`

> conversion radix.
  If is an `array`, element is radix between every nearby units,
  and filled with the last array element if length is more than 1 less than `options.units`.

#### `@param {T[]} [options.units=['', 'K', 'M', 'G', 'T', 'P', 'E']]`

> available units

See [decentUnit](index.js#L28)

## LICENSE

MIT
npm package: @lakca/onresize
Description: add resize listener on element.
Author: lakca
Latest version: 1.1.0

# onresize

> Listen on the change of HTML Element.

[![Build Status](https://travis-ci.org/lakca/onresize.svg?branch=master)](https://travis-ci.org/lakca/onresize)
[![codecov](https://codecov.io/gh/lakca/onresize/branch/master/graph/badge.svg)](https://codecov.io/gh/lakca/onresize)

## Usage

> By default, listen on the size change of element.

```js
const onresize = require('@lakca/onresize')
onresize(document.body, size => {
  console.log(size.width) // offsetWidth
  console.log(size.height) // offsetHeight
})
```

> Change default triggering frame(30) interval.

```js
onresize(document.body, { frame: 60 }, ...)
```

> Custom `getSize` and `equal` to listen on changes of other properties.

```js
onresize(document.body, {
  getSize(el) {
    const pos = el.getBoundingClientRect()
    return {
      x: el.top,
      y: el.left
    }
  },
  equal(a, b) {
    return a.x === b.x && a.y === b.y
  }
}, ...)
```

## API

### `onresize(HTMLElement, [options], callback)`

#### options.frame [number: 30]

> it uses `window.requestAnimationFrame` to conduct periodic detection of element changes.

> **The comparing operands are data retrieved in every adjacent triggering frame.**

> see [`window.requestAnimationFrame`](https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame)

#### options.getSize [function=defaultGetSize]

```js
function defaultGetSize(ele) {
  return {
    width: ele.offsetWidth,
    height: ele.offsetHeight
  }
}
```

> By default, the program listens on element layout size changing, you can provide `options.getSize` and `options.equal` to change retrieved data and comparing method, such as position of element.

#### options.equal [function=defaultEqual]

```js
function defaultEqual(one, other) {
  return one.width === other.width && one.height === other.height
}
```

> Also, you can listen on any change that is related to screen refreshing.

## LICENSE

MIT
npm package: @lakca/webpack-mock
Description: mock middleware for webpack(express).
Author: lakca
Latest version: 1.0.0

# Webpack Dev Server Mock Middleware

> Add mocked routes to webpack dev server. Also, this is just an [express][express] middleware, you can use this in any [express][express] used.

## Usage

> See detail in [test](test/main.js#L11).

```js
const mock = require('@lakca/webpack-mock')

module.exports = {
  devServer: {
    before(app) {
      mock(options)(app)
    }
  }
}
```

```js
const mock = require('@lakca/webpack-mock')
const app = express()
mock(options)(app)
```

## Options

### `options.routeFiles` {string|string[]}

Specify mock routes definition file/files, regarded as absolute path/paths where mock routes definition files are.

### `options.watch` {string|string[]}

Watch mock folders/files to refresh mock routes. if any folder will effect the mock data, it should be included.

## Mock Route Example

> See more examples in [test](test/data/mock.js), and template structure detail in [source code](index.js#L85)

```js
[
  'get', // method
  '/url-response/:name', // url
  '${req.params.name}' // response
]
```
```js
[
  'get',
  '/method-url-response-range/:name',
  '${req.params.name}',
  '1..2' // response is an array of response template, array length is within 1 and 2.
],
```
```js
[
  'get',
  '/method-url-response-args/:name',
  '${req.params.name}${arg0}',
  { arg0: 'hello' } // additional arguments of template interpolation.
],
```
```js
[
  'get',
  '/method-url-response-process_return/:name',
  '${req.params.name}',
  // additional processor of response data.
  (r/** generated response data */, req, res) => r + req.method
],
```
```js
[
  'get',
  '/response_is_function/:name',
  // determine response by function instead of template structure.
  (req, res, {count /** exact array length */, render /** render function of template structure */}) => render('${req.params.name}', { req })
],
```

## LICENSE

MIT

[express]: https://github.com/expressjs/express