<commit_before>var fs = require('fs'),
  path = require('path'),
  Table = require('cli-table'),
  config = require("../config.json"),
  pretty = require('pretty-date'),
  optimist = require('optimist'),
  util = require("./util.js")(optimist.argv);


// Initialize + load data
function DataGetter() {

  // Make the path to the db file
  var homeDir = process.env[(process.platform == 'win32') ? 'USERPROFILE' : 'HOME'];
  this.file = path.join(homeDir, config.wakefile);

  if (fs.existsSync(this.file)) {
    // read and parse the saved file
    try {
      this.data = JSON.parse(fs.readFileSync(this.file));
    } catch (e) {
      console.log(e);
      process.exit(-1);
    }
  } else {
    // make a new file
    this.data = {
      version: config.version,
      saved_macs: []
    };
    fs.writeFileSync(this.file, JSON.stringify(this.data));
  }
}

// get the list of saved items
DataGetter.prototype.getItems = function() {
  return this.data.saved_macs;
};

// return the element of given name, return false if not found
DataGetter.prototype.getItem = function(device) {
  var list = this.getItems();

  for (var index in list) {
    if (list[index].name == device) {
      return list[index];
    }
  }
  return false;
};

// return the index of device in array
DataGetter.prototype.indexOf = function(name) {
  var devices = this.getItems();
  for (var i in devices) {
    if (devices[i].name == name) {
      return i;
    }
  }
  return -1;
};

// does the device exist?
DataGetter.prototype.deviceExists = function(name) {
  if (this.indexOf(name) !== -1) {
    return true;
  } else {
    return false;
  }
};

// add device to data list and save
DataGetter.prototype.addItem = function(device) {
  this.data.saved_macs.push(device);
  this.save();
};

// remove device from data list and save
DataGetter.prototype.removeItem = function(name) {
  var i = this.indexOf(name);
  this.data.saved_macs.splice(i, 1);
  this.save();
};

// updates the last used time to 'now'
DataGetter.prototype.updateItemTime = function(name) {
  var i = this.indexOf(name);
  this.data.saved_macs[i].lastUse = Date.now();
  this.save();
};<commit_msg>rename a native function name<commit_after>var fs = require('fs'),
  path = require('path'),
  Table = require('cli-table'),
  config = require("../config.json"),
  pretty = require('pretty-date'),
  optimist = require('optimist'),
  util = require("./util.js")(optimist.argv);


// Initialize + load data
function DataGetter() {

  // Make the path to the db file
  var homeDir = process.env[(process.platform == 'win32') ? 'USERPROFILE' : 'HOME'];
  this.file = path.join(homeDir, config.wakefile);

  if (fs.existsSync(this.file)) {
    // read and parse the saved file
    try {
      this.data = JSON.parse(fs.readFileSync(this.file));
    } catch (e) {
      console.log(e);
      process.exit(-1);
    }
  } else {
    // make a new file
    this.data = {
      version: config.version,
      saved_macs: []
    };
    fs.writeFileSync(this.file, JSON.stringify(this.data));
  }
}

// get the list of saved items
DataGetter.prototype.getItems = function() {
  return this.data.saved_macs;
};

// return the element of given name, return false if not found
DataGetter.prototype.getItem = function(device) {
  var list = this.getItems();

  for (var index in list) {
    if (list[index].name == device) {
      return list[index];
    }
  }
  return false;
};

// return the index of device in array
DataGetter.prototype.indexOfDev = function(name) {
  var devices = this.getItems();
  for (var i in devices) {
    if (devices[i].name == name) {
      return i;
    }
  }
  return -1;
};

// does the device exist?
DataGetter.prototype.deviceExists = function(name) {
  if (this.indexOfDev(name) !== -1) {
    return true;
  } else {
    return false;
  }
};

// add device to data list and save
DataGetter.prototype.addItem = function(device) {
  this.data.saved_macs.push(device);
  this.save();
};

// remove device from data list and save
DataGetter.prototype.removeItem = function(name) {
  var i = this.indexOfDev(name);
  this.data.saved_macs.splice(i, 1);
  this.save();
};

// updates the last used time to 'now'
DataGetter.prototype.updateItemTime = function(name) {
  var i = this.indexOfDev(name);
  this.data.saved_macs[i].lastUse = Date.now();
  this.save();
};
{'fraction_non_alphanumeric': 0.15327793167128348, 'fraction_numerical': 0.002770083102493075, 'mean_word_length': 3.130600571973308, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '7440771', 'n_tokens_mistral': 1441, 'n_tokens_neox': 1447, 'n_words': 362}