<commit_before>import sendGCM from './sendGCM';
import APN from './sendAPN';
import sendADM from './sendADM';
import sendWNS from './sendWNS';
import sendWebPush from './sendWeb';
import {
  DEFAULT_SETTINGS,
  UNKNOWN_METHOD,
  WEB_METHOD,
  WNS_METHOD,
  ADM_METHOD,
  GCM_METHOD,
  APN_METHOD,
} from './constants';

class PN {
  constructor(options) {
    this.setOptions(options);
  }

  setOptions(opts) {
    this.settings = { ...DEFAULT_SETTINGS, ...opts };
    if (this.apn) {
      this.apn.shutdown();
    }
    this.apn = new APN(this.settings.apn);
  }

  sendWith(method, regIds, data, cb) {
    return method(regIds, data, this.settings)
      .then((results) => {
        (cb || ((noop) => noop))(null, results);
        return results;
      })
      .catch((error) => {
        (cb || ((noop) => noop))(error);
        return Promise.reject(error);
      });
  }

  getPushMethodByRegId(regId) {
    if (typeof regId === 'object') {
      return WEB_METHOD;
    } else if (this.settings.isAlwaysUseFCM) {
      return GCM_METHOD;
    } else if (regId.substring(0, 4) === 'http') {
      return WNS_METHOD;
    } else if (/^(amzn[0-9]*.adm)/i.test(regId)) {
      return ADM_METHOD;
    } else if (regId.length > 64) {
      return GCM_METHOD;
    } else if (regId.length === 64) {
      return APN_METHOD;
    }
    return UNKNOWN_METHOD;
  }

  send(_regIds, data, callback) {
    const promises = [];
    const regIdsGCM = [];
    const regIdsAPN = [];
    const regIdsWNS = [];
    const regIdsADM = [];
    const regIdsWebPush = [];
    const regIdsUnk = [];
    const regIds = Array.isArray(_regIds || []) ? _regIds || [] : [_regIds];
<commit_msg>fixed linter errors<commit_after>import sendGCM from './sendGCM';
import APN from './sendAPN';
import sendADM from './sendADM';
import sendWNS from './sendWNS';
import sendWebPush from './sendWeb';
import {
  DEFAULT_SETTINGS,
  UNKNOWN_METHOD,
  WEB_METHOD,
  WNS_METHOD,
  ADM_METHOD,
  GCM_METHOD,
  APN_METHOD,
} from './constants';

class PN {
  constructor(options) {
    this.setOptions(options);
  }

  setOptions(opts) {
    this.settings = { ...DEFAULT_SETTINGS, ...opts };
    if (this.apn) {
      this.apn.shutdown();
    }
    this.apn = new APN(this.settings.apn);
  }

  sendWith(method, regIds, data, cb) {
    return method(regIds, data, this.settings)
      .then((results) => {
        (cb || ((noop) => noop))(null, results);
        return results;
      })
      .catch((error) => {
        (cb || ((noop) => noop))(error);
        return Promise.reject(error);
      });
  }

  getPushMethodByRegId(regId) {
    if (typeof regId === 'object') {
      return WEB_METHOD;
    }
    if (this.settings.isAlwaysUseFCM) {
      return GCM_METHOD;
    }
    if (regId.substring(0, 4) === 'http') {
      return WNS_METHOD;
    }
    if (/^(amzn[0-9]*.adm)/i.test(regId)) {
      return ADM_METHOD;
    }
    if (regId.length > 64) {
      return GCM_METHOD;
    }
    if (regId.length === 64) {
      return APN_METHOD;
    }
    return UNKNOWN_METHOD;
  }

  send(_regIds, data, callback) {
    const promises = [];
    const regIdsGCM = [];
    const regIdsAPN = [];
    const regIdsWNS = [];
    const regIdsADM = [];
    const regIdsWebPush = [];
    const regIdsUnk = [];
    const regIds = Array.isArray(_regIds || []) ? _regIds || [] : [_regIds];

{'fraction_non_alphanumeric': 0.15983238551331935, 'fraction_numerical': 0.004788985333732416, 'mean_word_length': 2.609071274298056, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, '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': '7359561', 'n_tokens_mistral': 1223, 'n_tokens_neox': 1192, 'n_words': 247}