mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-19 17:38:19 +08:00
修复参加比赛的错误
This commit is contained in:
1 parent
32ad47e031
commit
f40e4e2c74
10 files changed
+62
-38
No files matched your search
@@ -11,6 +11,9 @@ exports.datetime_span = function (dt, relative = true, format = '%Y-%m-%d %H:%M:
|
||||
dt.format(format)
|
||||
);
|
||||
};
|
||||
exports.nl2br = function (self) {
|
||||
return self.replace(/\n/gm, '<br>');
|
||||
};
|
||||
exports.paginate = function* (page, num_pages) {
|
||||
let radius = 2, first, last;
|
||||
if (page > 1) {
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
module.exports = function* ranked(diter, equ = (a, b) => a == b) {
|
||||
let last_doc = null;
|
||||
let r = 0, count = 0;
|
||||
for (let doc of diter) {
|
||||
count++;
|
||||
if (count == 1 || !equ(last_doc, doc))
|
||||
r = count;
|
||||
last_doc = doc;
|
||||
yield [r, doc];
|
||||
}
|
||||
};
|
||||
Reference in new issue
Block a user