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 = [];
445445 * functional style.
446446 *
447447 ```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
451460 ```
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.
454464 */
455465function identity ( $ ) { return $ ; }
456466identity . $inject = [ ] ;
You can’t perform that action at this time.
0 commit comments