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

方法的返回值 #6

Closed
otakustay opened this issue Jul 30, 2014 · 0 comments
Closed

方法的返回值 #6

otakustay opened this issue Jul 30, 2014 · 0 comments
Labels

Comments

@otakustay
Copy link
Member

对于setadd这些方法,返回值如何选择:

  1. 不返回,这和ES的MapSet相符合
  2. 返回添加/移除的元素,这方便var i = model.set('x', 3)这样写代码,但是对于collection.remove这种可能操作多个元素的,返回值会不好定
  3. 返回this,便于链式调用,但链式没看到有啥好处,加上本来就有批量操作的fill之类的方法了
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant