MCPcopy
hub / github.com/webpack/webpack / reEncodeDigest

Function reEncodeDigest

lib/TemplatedPathPlugin.js:184–192  ·  view source on GitHub ↗
(value, fromDigest, toDigest)

Source from the content-addressed store, hash-verified

182 * @returns {string} re-encoded hash
183 */
184const reEncodeDigest = (value, fromDigest, toDigest) => {
185 if (toDigest === fromDigest) return value;
186 if (!isSupportedDigest(toDigest)) {
187 throw new Error(
188 `Unsupported hash digest "${toDigest}" in path template (use hex, base64, base64url, or base26/32/36/49/52/58/62)`
189 );
190 }
191 return bufferToDigest(digestToBuffer(value, fromDigest), toDigest);
192};
193
194/**
195 * Returns hash replacer function.

Callers 2

fnFunction · 0.85
reEncodeMethod · 0.85

Calls 3

isSupportedDigestFunction · 0.85
bufferToDigestFunction · 0.85
digestToBufferFunction · 0.85

Tested by

no test coverage detected