File tree Expand file tree Collapse file tree 1 file changed +15
-5
lines changed Expand file tree Collapse file tree 1 file changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -466,12 +466,22 @@ noop.$inject = [];
466
466
* functional style.
467
467
*
468
468
```js
469
- function transformer(transformationFn, value) {
470
- return (transformationFn || angular.identity)(value);
471
- };
469
+ function transformer(transformationFn, value) {
470
+ return (transformationFn || angular.identity)(value);
471
+ };
472
+
473
+ // E.g.
474
+ function getResult(fn, input) {
475
+ return (fn || angular.identity)(input);
476
+ };
477
+
478
+ getResult(function(n) { return n * 2; }, 21); // returns 42
479
+ getResult(null, 21); // returns 21
480
+ getResult(undefined, 21); // returns 21
472
481
```
473
- * @param {* } value to be returned.
474
- * @returns {* } the value passed in.
482
+ *
483
+ * @param {* } value to be returned.
484
+ * @returns {* } the value passed in.
475
485
*/
476
486
function identity ( $ ) { return $ ; }
477
487
identity . $inject = [ ] ;
You can’t perform that action at this time.
0 commit comments