feat: add http-status-code.md cheatsheet.

This commit is contained in:
jaywcjlove
2022-09-29 22:46:01 +08:00
parent 43bf0d4f77
commit 5094fac68a
10 changed files with 304 additions and 42 deletions

View File

@ -0,0 +1,18 @@
/** 标记 Number */
export function panelAddNumber(arr = [], result = []) {
let n = 0;
let level = -1;
while (n < arr.length) {
const toc = arr[n];
const titleNum = Number(toc?.tagName?.replace(/^h/, ''));
if (titleNum && titleNum > -1) {
level = titleNum;
}
if (toc) {
result.push({ ...toc, number: level })
}
n++;
}
return result
}