An open API service indexing awesome lists of open source software.

https://github.com/royalicing/scalemodel

Replicate a generator function’s code
https://github.com/royalicing/scalemodel

Last synced: 4 months ago
JSON representation

Replicate a generator function’s code

Awesome Lists containing this project

README

          


🧍🏼‍♂️🚂🧍🏾‍♀️ Scale Model


Replicate a generator function’s code



minified and gzipped size
minified size
zero dependencies

## Install

```console
npm add scalemodel
```

## Examples

```javascript
import { toCode } from "scalemodel";

function* Outer() {
yield Inner;
}

function* Inner() {
yield ["first", 1];
yield [2, "second"];
yield [3, "third", 3];
}

const jsCode = toCode(Outer);

/*
"function* Outer() {
\tyield Inner;
}

function* Inner() {
\tyield ["first",1];
\tyield [2,"second"];
\tyield [3,"third",3];
}"
*/
```

## TODO

- Regular expressions?
- Sets?
- Maps?
- Symbols?
- Minify?
- Web worker support!