MCPcopy Index your code
hub / github.com/di-sukharev/opencommit / parseMetadata

Function parseMetadata

out/cli.cjs:50772–50790  ·  view source on GitHub ↗
(metadata)

Source from the content-addressed store, hash-verified

50770 }
50771 if (compareBase64Mixed(actualValue, expectedValue)) {
50772 return true;
50773 }
50774 }
50775 return false;
50776 }
50777 var parseHashWithOptions = /(?<algo>sha256|sha384|sha512)-((?<hash>[A-Za-z0-9+/]+|[A-Za-z0-9_-]+)={0,2}(?:\s|$)( +[!-~]*)?)?/i;
50778 function parseMetadata(metadata) {
50779 const result = [];
50780 let empty = true;
50781 for (const token of metadata.split(" ")) {
50782 empty = false;
50783 const parsedToken = parseHashWithOptions.exec(token);
50784 if (parsedToken === null || parsedToken.groups === void 0 || parsedToken.groups.algo === void 0) {
50785 continue;
50786 }
50787 const algorithm = parsedToken.groups.algo.toLowerCase();
50788 if (supportedHashes.includes(algorithm)) {
50789 result.push(parsedToken.groups);
50790 }
50791 }
50792 if (empty === true) {
50793 return "no metadata";

Callers 1

bytesMatchFunction · 0.85

Calls 3

toLowerCaseMethod · 0.80
includesMethod · 0.80
pushMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…