Skip to content

RoyalIcing/scalemodel

Repository files navigation

🧍🏼‍♂️🚂🧍🏾‍♀️ 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?
  • Web worker support!

About

Replicate a generator function’s code

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published