code: function findFirstClosedCycle(keys) {
      var res = [];
      for (var i = 0; i < keys.length; ++i) {
          if (res.indexOf(keys[i]) > -1) {
              res.push(keys[i]);
              return res;
          }
          res.push(keys[i]);
      }
      return res;
  }
docs: @license
  Copyright Google Inc. All Rights Reserved.
  
  Use of this source code is governed by an MIT-style license that can be
  found in the LICENSE file at https://angular.io/license