richardscarrott / ok-computer

λ "Functions all the way down" data validation for JavaScript and TypeScript.
MIT License
79 stars 0 forks source link

WIP: Add PURE annotations #21

Open richardscarrott opened 2 years ago

richardscarrott commented 2 years ago

Input:

import { string } from "ok-computer";

console.log(string(1));

$ rollup

Output:

(function () {
  'use strict';

  var INTROSPECT = Symbol.for("ok-computer.introspect");
  var create = (predicate) => (err2) => (value, ...parents) => value === INTROSPECT || !predicate(value, ...parents) ? err2 : void 0;
  var typeOf = (str) => create((value) => typeof value === str)(`Expected typeof ${str}`);
  var string = typeOf("string");

  console.log(string(1));

})();
//# sourceMappingURL=bundle.js.map