From 480f2f33c1ed739757f6b5fd02b177604b8c1c1c Mon Sep 17 00:00:00 2001 From: Igor Minar Date: Wed, 24 Nov 2010 18:23:21 -0800 Subject: docs for angular.noop and angular.identity --- src/Angular.js | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'src/Angular.js') 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. +
+ function foo(callback) {
+ var result = calculateResult();
+ (callback || angular.noop)(result);
+ }
+
+ */
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.
+ *
+
+ function transformer(transformationFn, value) {
+ return (transformationFn || identity)(value);
+ };
+
+ */
function identity($) {return $;}
function valueFn(value) {return function(){ return value; };}
--
cgit v1.2.3