Permalink
Show file tree
Hide file tree
6 comments
on commit
sign in to comment.
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Rather than declaring empty anonymous functions all around, introduce…
… and use a single empty function. Thanks to Matt Kruse for the suggestion.
- Loading branch information
Showing
4 changed files
with
6 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6cb2945
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"noop" ? Isn't that: "no operation", abbreviated ? ... what was wrong with some combination of words "empty" and "function" ?
I think even: "emptyFunction" would work better.
After all in jQ we have "isArray", "isFunction" ...and other nice descriptive names ;o)
--DBJ
6cb2945
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@DBJDBJ: It's no operation perform which is quite meaningful I think.
6cb2945
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@DBJDBJ @rhacker hi, in the end of 2014, noop has become a thing. Thanks for addition of awesome function
6cb2945
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mubasshir thanks .. although for clarity sake I do maintain my position:
"noop" is not an empty function
function is not an operator, thus empty function can not be any kind of operator ...
ps: sometimes emptyFunction is also called nullFunction , which is also OK.
6cb2945
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very impressive.
No operation by the way.
6cb2945
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we what, seven years after the last comment? I can proceed :) What is "very impressive"?
JavaScript has no NOP (aka noop) statement. Alternatives 2021, are:
Function.prototype()
-- accepts any arguments and returns undefinedconst noop = () => {};
I vote 1. Name it anything you like. Whoever you are.