<commit_before>class Storage {
  constructor(userId) {
    Object.assign(this, { userId });
  }

  storePack(packName, packTitle, packStickers) {
    const stickers = packStickers.map(packSticker => (
      {
        image: packSticker.image,
        content_id: packSticker.content_id
      }
    ));

    try {
      const key = `${this.userId}-${packName}`;
      const data = {
        name: packName,
        title: packTitle,
        stickers
      };

      const value = JSON.stringify(data);

      localStorage.setItem(key, value);
    } catch (err) {
      console.warn('Error while saving to localStorage.', err);
    }
  }

  getPack(packName) {
    try {
      const key = `${this.userId}-${packName}`;

      const storedPack = JSON.parse(localStorage.getItem(key));

      return storedPack;
    } catch (err) {
      console.warn('Error while retrieving item from localStorage.', err);
    }

    return null;
  }

  storeMyPacks(packs) {
    try {
      const key = `${this.userId}-sticker-packs`;
      const data = packs.map(pack => (
        {
          pack_name: pack.pack_name,
          main_icon: pack.main_icon
        }
      ));

      const value = JSON.stringify(data);

      localStorage.setItem(key, value);
    } catch (err) {
      console.warn('Error while saving to localStorage.', err);
    }
  }

  getMyPacks() {
    try {
      const key = `${this.userId}-sticker-packs`;

      const storedPacks = JSON.parse(localStorage.getItem(key));

      return storedPacks;
    } catch (err) {
      console.warn('Error while retrieving item from localStorage.', err);
    }

    return null;
  }
}

export default Storage;
<commit_msg>:twisted_rightwards_arrows: Merged master<commit_after>class Storage {
  constructor(userId) {
    Object.assign(this, { userId });
  }

  static storeItem(key, value) {
    try {
      localStorage.setItem(key, JSON.stringify(value));
    } catch (err) {
      console.warn('Error while saving to localStorage.', err);
    }
  }

  static getItem(key) {
    let item = null;

    try {
      item = JSON.parse(localStorage.getItem(key));
    } catch (err) {
      console.warn('Error while retrieving item from localStorage.', err);
    }

    return item;
  }

  storePack(packName, packTitle, packStickers) {
    const stickers = packStickers.map(packSticker => (
      {
        image: packSticker.image,
        content_id: packSticker.content_id
      }
    ));

    const key = `${this.userId}-${packName}`;
    const value = {
      name: packName,
      title: packTitle,
      stickers
    };

    this.constructor.storeItem(key, value);
  }

  getPack(packName) {
    const key = `${this.userId}-${packName}`;

    return this.constructor.getItem(key);
  }

  storeMyPacks(packs) {
    const key = `${this.userId}-sticker-packs`;
    const value = packs.map(pack => (
      {
        pack_name: pack.pack_name,
        main_icon: pack.main_icon
      }
    ));

    this.constructor.storeItem(key, value);
  }

  getMyPacks() {
    const key = `${this.userId}-sticker-packs`;

    return this.constructor.getItem(key);
  }
}

export default Storage;

{'fraction_non_alphanumeric': 0.13226837060702876, 'fraction_numerical': 0.0, 'mean_word_length': 2.440659340659341, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '7079862', 'n_tokens_mistral': 1015, 'n_tokens_neox': 1006, 'n_words': 199}