diff options
| author | Igor Minar | 2010-11-24 18:23:21 -0800 | 
|---|---|---|
| committer | Igor Minar | 2010-11-24 18:23:21 -0800 | 
| commit | 480f2f33c1ed739757f6b5fd02b177604b8c1c1c (patch) | |
| tree | f4d1836c98dbe2acc6ce4c9bf4322149b444f93d /src/Angular.js | |
| parent | 9c9a89f7ff6fa964bad6437d30cb0651f8366e8f (diff) | |
| download | angular.js-480f2f33c1ed739757f6b5fd02b177604b8c1c1c.tar.bz2 | |
docs for angular.noop and angular.identity
Diffstat (limited to 'src/Angular.js')
| -rw-r--r-- | src/Angular.js | 34 | 
1 files changed, 34 insertions, 0 deletions
diff --git a/src/Angular.js b/src/Angular.js index fb23e1f2..60aa0259 100644 --- a/src/Angular.js +++ b/src/Angular.js @@ -580,7 +580,41 @@ function inherit(parent, extra) {    return extend(new (extend(function(){}, {prototype:parent}))(), extra);  } + +/** + * @workInProgress + * @ngdoc function + * @name angular.noop + * @function + * + * @description + * Empty function that performs no operation whatsoever. This function is useful when writing code + * in the functional style. +   <pre> +     function foo(callback) { +       var result = calculateResult(); +       (callback || angular.noop)(result); +     } +   </pre> + */  function noop() {} + +/** + * @workInProgress + * @ngdoc function + * @name angular.identity + * @function + * + * @description + * A function that does nothing except for returning its first argument. This function is useful + * when writing code in the functional style. + * +   <pre> +     function transformer(transformationFn, value) { +       return (transformationFn || identity)(value); +     }; +   </pre> + */  function identity($) {return $;}  function valueFn(value) {return function(){ return value; };}  | 
