@typed/fp
Version:
Data Structures and Resources for fp-ts
64 lines • 1.82 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.toGuard = exports.toEq = exports.toDecoder = exports.interpret = exports.create = exports.withUnion = exports.withRefine = exports.make = void 0;
const tslib_1 = require("tslib");
const D = (0, tslib_1.__importStar)(require("./Decoder"));
const Eq = (0, tslib_1.__importStar)(require("./Eq"));
const G = (0, tslib_1.__importStar)(require("./Guard"));
const Schemable_1 = require("./Schemable");
// -------------------------------------------------------------------------------------
// constructors
// -------------------------------------------------------------------------------------
/**
* @category Constructor
* @since 0.9.4
*/
function make(schema) {
return (0, Schemable_1.memoize)(schema);
}
exports.make = make;
/**
* @category Constructor
* @since 0.9.5
*/
function withRefine(schema) {
return (0, Schemable_1.memoize)(schema);
}
exports.withRefine = withRefine;
/**
* @category Constructor
* @since 0.9.5
*/
function withUnion(schema) {
return (0, Schemable_1.memoize)(schema);
}
exports.withUnion = withUnion;
/**
* @category Constructor
* @since 0.9.5
*/
function create(schema) {
return (0, Schemable_1.memoize)(schema);
}
exports.create = create;
/**
* @since 0.9.4
* @category Combinator
*/
exports.interpret = ((schemable) => (schema) => schema(schemable));
/**
* @since 0.9.5
* @category Combinator
*/
exports.toDecoder = (0, exports.interpret)({ ...D.Schemable, ...D.WithUnion, ...D.WithRefine });
/**
* @since 0.9.5
* @category Combinator
*/
exports.toEq = (0, exports.interpret)(Eq.Schemable);
/**
* @since 0.9.5
* @category Combinator
*/
exports.toGuard = (0, exports.interpret)({ ...G.Schemable, ...G.WithUnion, ...G.WithRefine });
//# sourceMappingURL=Schema.js.map