"Fossies" - the Fresh Open Source Software Archive

Member "angular-1.7.9/docs/partials/api/ng/function/angular.identity.html" (26 Nov 2019, 2232 Bytes) of package /linux/www/angular-1.7.9.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) HTML source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 <a href='https://github.com/angular/angular.js/edit/v1.7.x/src/Angular.js?message=docs(angular.identity)%3A%20describe%20your%20change...#L457' class='improve-docs btn btn-primary'><i class="glyphicon glyphicon-edit">&nbsp;</i>Improve this Doc</a>
    2 
    3 
    4 
    5 <a href='https://github.com/angular/angular.js/tree/v1.7.9/src/Angular.js#L457' class='view-source pull-right btn btn-primary'>
    6   <i class="glyphicon glyphicon-zoom-in">&nbsp;</i>View Source
    7 </a>
    8 
    9 
   10 <header class="api-profile-header">
   11   <h1 class="api-profile-header-heading">angular.identity</h1>
   12   <ol class="api-profile-header-structure naked-list step-list">
   13     
   14     <li>
   15       - function in module <a href="api/ng">ng</a>
   16     </li>
   17   </ol>
   18 </header>
   19 
   20 
   21 
   22 
   23 
   24 <div class="api-profile-description">
   25   <h2 id="overview">Overview</h2>
   26   <p>A function that returns its first argument. This function is useful when writing code in the
   27 functional style.</p>
   28 <pre><code class="lang-js">function transformer(transformationFn, value) {
   29   return (transformationFn || angular.identity)(value);
   30 };
   31 
   32 // E.g.
   33 function getResult(fn, input) {
   34   return (fn || angular.identity)(input);
   35 };
   36 
   37 getResult(function(n) { return n * 2; }, 21);   // returns 42
   38 getResult(null, 21);                            // returns 21
   39 getResult(undefined, 21);                       // returns 21
   40 </code></pre>
   41 
   42 </div>
   43 
   44 
   45 
   46 
   47 <div>
   48   
   49 
   50   
   51 
   52   <h2 id="usage">Usage</h2>
   53     
   54       <p><code>angular.identity(value);</code></p>
   55 
   56 
   57     
   58 
   59     
   60 <section class="api-section">
   61   <h3 id="angular.identity-arguments">Arguments</h3>
   62 
   63 <table class="variables-matrix input-arguments">
   64   <thead>
   65     <tr>
   66       <th>Param</th>
   67       <th>Type</th>
   68       <th>Details</th>
   69     </tr>
   70   </thead>
   71   <tbody>
   72     
   73     <tr>
   74       <td>
   75         value
   76         
   77         
   78       </td>
   79       <td>
   80         <a href="" class="label type-hint type-hint-object">*</a>
   81       </td>
   82       <td>
   83         <p>to be returned.</p>
   84 
   85         
   86       </td>
   87     </tr>
   88     
   89   </tbody>
   90 </table>
   91 
   92 </section>
   93     
   94 
   95     <h3 id="angular.identity-returns">Returns</h3>
   96 <table class="variables-matrix return-arguments">
   97   <tr>
   98     <td><a href="" class="label type-hint type-hint-object">*</a></td>
   99     <td><p>the value passed in.</p>
  100 </td>
  101   </tr>
  102 </table>
  103 
  104   
  105   
  106   
  107 
  108 
  109 
  110   
  111 </div>
  112 
  113