UNPKG

@typed/content-hash

Version:

Content hash a directory of HTML/JS/CSS files and other static assets

15 lines 740 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getContentHash = void 0; const function_1 = require("fp-ts/function"); const Option_1 = require("fp-ts/Option"); const getContentHash = (document, registry, hashLength) => (0, function_1.pipe)(document.contentHash, (0, Option_1.chain)((hash) => { switch (hash.type) { case 'hash': return (0, Option_1.of)(hash.hash.slice(0, hashLength)); case 'hashFor': return (0, function_1.pipe)(registry.get(hash.filePath), Option_1.fromNullable, (0, Option_1.chain)((d) => (0, exports.getContentHash)(d, registry, hashLength))); } })); exports.getContentHash = getContentHash; //# sourceMappingURL=getContentHash.js.map