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