We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
function mapRoute(instance: Object) { const prototype = Object.getPrototypeOf(instance); // 筛选出类的 methodName const methodsNames = Object.getOwnPropertyNames(prototype) .filter(item => !isConstructor(item) && isFunction(prototype[item])); return methodsNames.map(methodName => { const fn = prototype[methodName]; // 取出定义的 metadata const route = Reflect.getMetadata(PATH_METADATA, fn); const method = Reflect.getMetadata(METHOD_METADATA, fn); return { route, method, fn, methodName } }) };
这里缺少 isConstructor 和 isFunction函数。
测试之后,加上这俩函数即可解决问题。
export const isFunction = (fn: any): boolean => typeof fn === 'function'; export const isConstructor = (fn: any): boolean => fn === 'constructor';
The text was updated successfully, but these errors were encountered:
No branches or pull requests
这里缺少 isConstructor 和 isFunction函数。
测试之后,加上这俩函数即可解决问题。
The text was updated successfully, but these errors were encountered: