<commit_before>
angular.module('flashpoint')
.directive('fpPage', function($q, $animate, Fireproof) {

  /**
   * @ngdoc directive
   * @name fpPage
   * @description Pages over the keys at a Firebase location.
   *
   * fpPage exposes the following methods and variables on local scope:
   *
   * | Variable       | Type                 | Details                                                    |
   * |----------------|----------------------|------------------------------------------------------------|
   * | `$next`        | {@type function}     | Fetches the next set of values into scope.                 |
   * | `$previous`    | {@type function}     | Fetches the previous set of values into scope.             |
   * | `$reset`       | {@type function}     | Starts again at the beginning.                             |
   * | `$keys`        | {@type Array.string} | The keys in the current page.                              |
   * | `$values`      | {@type Array.*}      | The values in the current page.                            |
   * | `$priorities`  | {@type Array.*}      | The priorities in the current page.                        |
   * | `$hasNext`     | {@type boolean}      | True if there are more values to page over.                |
   * | `$hasPrevious` | {@type boolean}      | True if there are previous values to page back over again. |
   * | `$paging`      | {@type boolean}      | True if a paging operation is currently in progress.       |
   * | `$pageNumber`  | {@type number}       | The current page number of results.                        |
   * | `$error`       | {@type Error}        | The most recent error returned from Firebase or undefined. |
   *
   *
   * @restrict A
   * @element ANY
   * @scope
   * @param {expression} fpPage Path to the location in the Firebase, like
   * `favorites/{{ $auth.uid }}`. Interpolatable.
   * @param {expression} as The name of a variable on scope to bind. So you could do
   * something like
   * `<example fp-page="users/{{ $auth.uid }}" as="users">
   *   <ul>
   *     <li ng-repeat="user in users"> {{ user.name }} </li>
   *   </ul>
   * </example>`
   * @param {expression} onPage An expression that gets evaluated when a new page
   * is available.
   * @param {expression} onError An expression that gets evaluated when Firebase
   * returns an error.
   * @param {expression} limit The count of objects in each page.
   */

  return {

    restrict: 'A',
    scope: true,
    require: '^firebase',
    link: function(scope, el, attrs, fp) {

      var ref, pager;

      var setPage = function(snaps) {

        $animate.removeClass(el, 'fp-paging');
        scope.$paging = false;

        scope.$hasPrevious = scope.$pageNumber > 1;
        scope.$hasNext = (snaps.length === parseInt(attrs.limit));

        scope.$keys = snaps.map(function(snap) {
          return snap.name();
        });

        scope.$values = snaps.map(function(snap) {
          return snap.val();
        });

        scope.$priorities = snaps.map(function(snap) {
          return snap.getPriority();
        });

        if (attrs.as) {
          scope[attrs.as] = scope.$values;
        }

        if (attrs.onPage) {
          scope.$evalAsync(attrs.onPage);<commit_msg>replace .name() with .key()<commit_after>
angular.module('flashpoint')
.directive('fpPage', function($q, $animate, Fireproof) {

  /**
   * @ngdoc directive
   * @name fpPage
   * @description Pages over the keys at a Firebase location.
   *
   * fpPage exposes the following methods and variables on local scope:
   *
   * | Variable       | Type                 | Details                                                    |
   * |----------------|----------------------|------------------------------------------------------------|
   * | `$next`        | {@type function}     | Fetches the next set of values into scope.                 |
   * | `$previous`    | {@type function}     | Fetches the previous set of values into scope.             |
   * | `$reset`       | {@type function}     | Starts again at the beginning.                             |
   * | `$keys`        | {@type Array.string} | The keys in the current page.                              |
   * | `$values`      | {@type Array.*}      | The values in the current page.                            |
   * | `$priorities`  | {@type Array.*}      | The priorities in the current page.                        |
   * | `$hasNext`     | {@type boolean}      | True if there are more values to page over.                |
   * | `$hasPrevious` | {@type boolean}      | True if there are previous values to page back over again. |
   * | `$paging`      | {@type boolean}      | True if a paging operation is currently in progress.       |
   * | `$pageNumber`  | {@type number}       | The current page number of results.                        |
   * | `$error`       | {@type Error}        | The most recent error returned from Firebase or undefined. |
   *
   *
   * @restrict A
   * @element ANY
   * @scope
   * @param {expression} fpPage Path to the location in the Firebase, like
   * `favorites/{{ $auth.uid }}`. Interpolatable.
   * @param {expression} as The name of a variable on scope to bind. So you could do
   * something like
   * `<example fp-page="users/{{ $auth.uid }}" as="users">
   *   <ul>
   *     <li ng-repeat="user in users"> {{ user.name }} </li>
   *   </ul>
   * </example>`
   * @param {expression} onPage An expression that gets evaluated when a new page
   * is available.
   * @param {expression} onError An expression that gets evaluated when Firebase
   * returns an error.
   * @param {expression} limit The count of objects in each page.
   */

  return {

    restrict: 'A',
    scope: true,
    require: '^firebase',
    link: function(scope, el, attrs, fp) {

      var ref, pager;

      var setPage = function(snaps) {

        $animate.removeClass(el, 'fp-paging');
        scope.$paging = false;

        scope.$hasPrevious = scope.$pageNumber > 1;
        scope.$hasNext = (snaps.length === parseInt(attrs.limit));

        scope.$keys = snaps.map(function(snap) {
          return snap.key();
        });

        scope.$values = snaps.map(function(snap) {
          return snap.val();
        });

        scope.$priorities = snaps.map(function(snap) {
          return snap.getPriority();
        });

        if (attrs.as) {
          scope[attrs.as] = scope.$values;
        }

        if (attrs.onPage) {
          scope.$evalAsync(attrs.onPage);
{'fraction_non_alphanumeric': 0.15401135143426906, 'fraction_numerical': 0.00030679552078539653, 'mean_word_length': 1.6590538336052203, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4497360', 'n_tokens_mistral': 1834, 'n_tokens_neox': 1781, 'n_words': 566}