训练(题单)功能

This commit is contained in:
masnn committed 2020-04-16 22:19:31 +08:00
1 parent e06283c0cc
commit 97b0d782b9
24 files changed
+466 -105

No files matched your search

+8
View File
@@ -21,6 +21,10 @@ const isName = (s) => s && s.length < 256;
const checkName = (s) => { if (!isName(s)) throw new ValidationError('name'); else return s; };
const isPid = (s) => RE_PID.test(s.toString());
const checkPid = (s) => { if (!RE_PID.test(s)) throw new ValidationError('pid'); else return s; };
const isIntro = () => true;
const checkIntro = (s) => { if (!isIntro(s)) throw new ValidationError('intro'); else return s; };
const isDescription = () => true;
const checkDescription = (s) => { if (!isDescription(s)) throw new ValidationError('description'); else return s; };
module.exports = {
isTitle,
@@ -39,6 +43,10 @@ module.exports = {
checkName,
isPid,
checkPid,
isIntro,
checkIntro,
isDescription,
checkDescription,
};
/*
ID_RE = re.compile(r'[^\\/\s\u3000]([^\\/\n\r]*[^\\/\s\u3000])?')