<commit_before>/**
 * @flow
 */
import Reference from './reference.js';

export default class Snapshot {
  static key:String;
  static value:Object;
  static exists:boolean;
  static hasChildren:boolean;
  static childrenCount:Number;
  static childKeys:String[];

  ref: Object;
  key: string;
  value: any;
  exists: boolean;
  priority: any;
  hasChildren: boolean;
  childrenCount: number;
  childKeys: Array<string>;

  constructor(ref: Reference, snapshot: Object) {
    this.ref   = ref;
    this.key   = snapshot.key;
    this.value = snapshot.value;
    this.exists = snapshot.exists || true;
    this.priority = snapshot.priority;
    this.hasChildren = snapshot.hasChildren || false;
    this.childrenCount = snapshot.childrenCount || 0;
    this.childKeys = snapshot.childKeys || [];
  }

  val() {
    return this.value;
  }

  forEach(fn: (key: any) => any) {
    (this.childKeys || [])
      .forEach(key => fn(this.value[key]));
  }

  map(fn: (key: string) => mixed) {
    let arr = [];
    this.forEach(item => arr.push(fn(item)));
    return arr;
  }

  reverseMap(fn: (key: string) => mixed) {
    return this.map(fn).reverse();
  }
}<commit_msg>misc snapshot linting<commit_after>/**
 * @flow
 */
import Reference from './reference.js';

export default class Snapshot {
  static key: String;
  static value: Object;
  static exists: boolean;
  static hasChildren: boolean;
  static childrenCount: Number;
  static childKeys: String[];

  ref: Object;
  key: string;
  value: any;
  exists: boolean;
  priority: any;
  hasChildren: boolean;
  childrenCount: number;
  childKeys: Array<string>;

  constructor(ref: Reference, snapshot: Object) {
    this.ref = ref;
    this.key = snapshot.key;
    this.value = snapshot.value;
    this.exists = snapshot.exists || true;
    this.priority = snapshot.priority;
    this.hasChildren = snapshot.hasChildren || false;
    this.childrenCount = snapshot.childrenCount || 0;
    this.childKeys = snapshot.childKeys || [];
  }

  val() {
    return this.value;
  }

  forEach(fn: (key: any) => any) {
    (this.childKeys || [])
      .forEach(key => fn(this.value[key]));
  }

  map(fn: (key: string) => mixed) {
    const arr = [];
    this.forEach(item => arr.push(fn(item)));
    return arr;
  }

  reverseMap(fn: (key: string) => mixed) {
    return this.map(fn).reverse();
  }
}
{'fraction_non_alphanumeric': 0.1493174061433447, 'fraction_numerical': 0.0008532423208191126, 'mean_word_length': 3.2558983666061705, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2741160', 'n_tokens_mistral': 768, 'n_tokens_neox': 751, 'n_words': 182}