Skip to content
New issue

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

添加条件判断装饰器 #32

Open
4 tasks
Genluo opened this issue Nov 17, 2021 · 0 comments
Open
4 tasks

添加条件判断装饰器 #32

Genluo opened this issue Nov 17, 2021 · 0 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@Genluo
Copy link
Member

Genluo commented Nov 17, 2021

函数描述

通过装饰器针对参数GET进行拦截,如果conditions返回为True,执行自定义operation函数

函数接口

type Options<I> = [conditions: (v: I) => boolean, operation: (target: Object, propertyKey: string | symbol) => void];

export interface handleDescriptor<T> {
  (target: Object, propertyKey: string | symbol, options: Options<T>): void;
}

测试用例

测试用例应该包含如下:T

  • 参数校验传入options非函数
  • conditions、operation执行过程中throw error
  • operation中参数是否正确
  • propertyKey为symbol情况
@Genluo Genluo added the enhancement New feature or request label Nov 17, 2021
@Genluo Genluo changed the title 添加validate中的报警数据校验 添加validate中的数据条件判断装饰器 Nov 17, 2021
@Genluo Genluo changed the title 添加validate中的数据条件判断装饰器 添加条件判断装饰器 Nov 17, 2021
@Genluo Genluo added this to the new utils milestone Dec 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants