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

Method update

lib/util/hash/DebugHash.js:39–53  ·  view source on GitHub ↗

* Update hash {@link https://nodejs.org/api/crypto.html#crypto_hash_update_data_inputencoding} * @param {string | Buffer} data data * @param {Encoding=} inputEncoding data encoding * @returns {Hash} updated hash

(data, inputEncoding)

Source from the content-addressed store, hash-verified

37 * @returns {Hash} updated hash
38 */
39 update(data, inputEncoding) {
40 if (typeof data !== "string") data = data.toString("utf8");
41 const prefix = Buffer.from("@webpack-debug-digest@").toString("hex");
42 if (data.startsWith(prefix)) {
43 data = Buffer.from(data.slice(prefix.length), "hex").toString();
44 }
45 this.string += `[${data}](${
46 /** @type {string} */
47 (
48 // eslint-disable-next-line unicorn/error-message
49 new Error().stack
50 ).split("\n", 3)[2]
51 })\n`;
52 return this;
53 }
54
55 /**
56 * Calculates the digest {@link https://nodejs.org/api/crypto.html#crypto_hash_digest_encoding}

Callers

nothing calls this directly

Calls 3

sliceMethod · 0.80
splitMethod · 0.80
toStringMethod · 0.45

Tested by

no test coverage detected