MCPcopy
hub / github.com/webpack/webpack / update

Function update

lib/util/hash/hash-digest.js:149–172  ·  view source on GitHub ↗
(hash, data, encoding)

Source from the content-addressed store, hash-verified

147 * @returns {void}
148 */
149const update = (hash, data, encoding) => {
150 if (encoding === "base64url" && !isBase64URLSupported) {
151 const base64String = /** @type {string} */ (data)
152 .replace(/-/g, "+")
153 .replace(/_/g, "/");
154 const buf = Buffer.from(base64String, "base64");
155 hash.update(buf);
156 return;
157 } else if (
158 typeof data === "string" &&
159 encoding &&
160 typeof ENCODE_TABLE[/** @type {Base} */ (encoding.slice(4))] !== "undefined"
161 ) {
162 const buf = decode(data, /** @type {Base} */ (encoding.slice(4)));
163 hash.update(buf);
164 return;
165 }
166
167 if (encoding) {
168 hash.update(/** @type {string} */ (data), encoding);
169 } else {
170 hash.update(data);
171 }
172};
173
174/**
175 * Returns digest.

Callers 9

updateMethod · 0.70
digestMethod · 0.70
updateMethod · 0.70
digestMethod · 0.70
updateThrottledMethod · 0.50
moduleBuildMethod · 0.50
moduleDoneMethod · 0.50
entryDoneMethod · 0.50
_applyOnCompilerMethod · 0.50

Calls 4

decodeFunction · 0.85
sliceMethod · 0.80
replaceMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected