npm.io
0.1.0 • Published 5 years ago

scalemodel

Licence
MIT
Version
0.1.0
Deps
0
Size
15 kB
Vulns
0
Weekly
0

Scale Model

Replicate a generator function’s code

minified and gzipped size minified size zero dependencies

Install

npm add scalemodel

Examples

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?