-
Notifications
You must be signed in to change notification settings - Fork 2k
Closed
Labels
Description
One of the things I really like about jQuery is how everything is chainable.
I like to be able to write:
object.doFoo().doBar().doBaz()
and have all those things done to object. Unfortunately, some libraries don't code that way and I have to do:
object.doFoo()
object.doBar()
object.doBaz()
I could use the with statement but Douglas Crockford wouldn't be happy. I could use a list comprehension but that doesn't seem like a very clean solution.
Could we have some syntax that would let me write something like:
object!.doFoo()
!.doBar()
!.doBaz()
And have it rewritten
object.doFoo()
object.doBar()
object.doBaz()
?
That would give us the advantages of the with statement without the drawbacks.