core: 自动转换pid

This commit is contained in:
undefined committed 2021-05-14 12:42:09 +08:00
1 parent af345d78de
commit 9b3ceb82de
4 files changed
+10 -6

No files matched your search

+4
View File
@@ -81,6 +81,8 @@ export const checkIntro = (s) => { if (!isIntro()) throw new ValidationError('in
export const isDescription = (s: any) => s && s.length < 65536;
export const checkDescription = (s) => { if (!(s && s.length < 65536)) throw new ValidationError('description'); else return s; };
export const parsePid = (s) => (Number.isNaN(+s) ? s : `P${s}`);
global.Hydro.lib.validator = {
validate,
isTitle,
@@ -105,4 +107,6 @@ global.Hydro.lib.validator = {
checkIntro,
isDescription,
checkDescription,
parsePid,
};