Skip to content

Commit 27b7cf0

Browse files
Merge pull request #68 from dmohns/remove-leftover-sum-function
cleanup: remove leftover `sum` function
2 parents a95a9a2 + e8de274 commit 27b7cf0

File tree

1 file changed

+0
-54
lines changed

1 file changed

+0
-54
lines changed

src/mermaid-markdown.ts

-54
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,4 @@
11
export const MermaidMarkdown = (md, pluginOptions) => {
2-
const sum = (o) => {
3-
function pad(hash, len) {
4-
while (hash.length < len) {
5-
hash = "0" + hash;
6-
}
7-
return hash;
8-
}
9-
10-
function fold(hash, text) {
11-
var i;
12-
var chr;
13-
var len;
14-
if (text.length === 0) {
15-
return hash;
16-
}
17-
for (i = 0, len = text.length; i < len; i++) {
18-
chr = text.charCodeAt(i);
19-
hash = (hash << 5) - hash + chr;
20-
hash |= 0;
21-
}
22-
return hash < 0 ? hash * -2 : hash;
23-
}
24-
25-
function foldObject(hash, o, seen) {
26-
return Object.keys(o).sort().reduce(foldKey, hash);
27-
function foldKey(hash, key) {
28-
return foldValue(hash, o[key], key, seen);
29-
}
30-
}
31-
32-
function foldValue(input, value, key, seen) {
33-
var hash = fold(fold(fold(input, key), toString(value)), typeof value);
34-
if (value === null) {
35-
return fold(hash, "null");
36-
}
37-
if (value === undefined) {
38-
return fold(hash, "undefined");
39-
}
40-
if (typeof value === "object") {
41-
if (seen.indexOf(value) !== -1) {
42-
return fold(hash, "[Circular]" + key);
43-
}
44-
seen.push(value);
45-
return foldObject(hash, value, seen);
46-
}
47-
return fold(hash, value.toString());
48-
}
49-
50-
function toString(o) {
51-
return Object.prototype.toString.call(o);
52-
}
53-
return pad(foldValue(0, o, "", []).toString(16), 8);
54-
};
55-
562
const fence = md.renderer.rules.fence.bind(md.renderer.rules);
573

584
md.renderer.rules.fence = (tokens, index, options, env, slf) => {

0 commit comments

Comments
 (0)