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 @@ -445,12 +445,22 @@ noop.$inject = [];
445
445
* functional style.
446
446
*
447
447
```js
448
- function transformer(transformationFn, value) {
449
- return (transformationFn || angular.identity)(value);
450
- };
448
+ function transformer(transformationFn, value) {
449
+ return (transformationFn || angular.identity)(value);
450
+ };
451
+
452
+ // E.g.
453
+ function getResult(fn, input) {
454
+ return (fn || angular.identity)(input);
455
+ };
456
+
457
+ getResult(function(n) { return n * 2; }, 21); // returns 42
458
+ getResult(null, 21); // returns 21
459
+ getResult(undefined, 21); // returns 21
451
460
```
452
- * @param {* } value to be returned.
453
- * @returns {* } the value passed in.
461
+ *
462
+ * @param {* } value to be returned.
463
+ * @returns {* } the value passed in.
454
464
*/
455
465
function identity ( $ ) { return $ ; }
456
466
identity . $inject = [ ] ;
You can’t perform that action at this time.
0 commit comments