lin-cms-test
Version:
The core library of Lin CMS, this package is just for test!
67 lines (66 loc) • 2.27 kB
TypeScript
import { IRouterContext } from "koa-router";
export declare const isUndefined: (obj: any) => obj is undefined;
export declare const isFunction: (fn: any) => boolean;
export declare const isObject: (fn: any) => fn is object;
export declare const isString: (fn: any) => fn is string;
export declare const isConstructor: (fn: string) => boolean;
export declare const validatePath: (path?: string | undefined) => string;
export declare const isNil: (obj: null) => boolean;
export declare const isEmpty: (array: {
length: number;
}) => boolean;
export declare const isSymbol: (fn: any) => fn is symbol;
/**
* Assertion utility.
*/
export declare function assert(ok: boolean, ...args: string[]): void;
export declare function toHump(name: string): string;
export declare function toLine(name: string): string;
/**
* 通过当前的路由名找到对应的权限录入信息
* @param ctx koa 的 context
*/
export declare function findAuthAndModule(ctx: IRouterContext): any;
export declare function findMetaByAuth(auth: any): any;
/**
* 检查日期的格式为 "YYYY-MM-DD HH:mm:ss"
* @param time input time
*/
export declare function checkDateFormat(time: string): boolean;
export declare function paginate(ctx: IRouterContext): {
start: any;
count: any;
};
export declare function unsets(obj: any, props: Array<string>): void;
/**
* 在js中使用装饰器语法的语法糖函数
* @param {*} decorators 装饰器
* @param {*} type 被装饰值的类型 String | Array
* @param {*} target 被装饰类的原型
* @param {*} key 被装饰器类的键
* @example
* tslib.__decorate([
* Length(2, 20, {
* message: "昵称长度必须在2~10之间"
* }),
* IsNotEmpty({
* message: "昵称不可为空"
* }),
* tslib.__metadata("design:type", String)
* ] , RegisterForm.prototype, "nickname", void 0);
* // 可被转化为
* decorate(
* [Length(2, 20, {
* message: "昵称长度必须在2~10之间"
* }),
* IsNotEmpty({
* message: "昵称不可为空"
* })],
* String,
* RegisterForm.prototype,
* "nickname"
* )
*/
export declare function decorateProp(decorators: any, type: any, target: any, key: any): any;
export declare function getAllMethodNames(obj: any): any[];
export declare function getFiles(dir: string): string[];