<commit_before>// Copyright (c) ppy Pty Ltd <<EMAIL>>. Licensed under the GNU Affero General Public License v3.0.
// See the LICENCE file in the repository root for full licence text.

import Fade from 'fade';

const Blackout = {
  hide: () => Blackout.toggle(false),

  show: () => Blackout.toggle(true),

  toggle: (state: boolean, opacity?: number) => {
    const el = document.querySelector('.js-blackout');

    if (el instanceof HTMLElement) {
      el.style.opacity = !state || opacity === undefined ? '' : String(opacity);
      Fade.toggle(el, state);
    }
  },
};

export default Blackout;<commit_msg>Simpler null check<commit_after>// Copyright (c) ppy Pty Ltd <<EMAIL>>. Licensed under the GNU Affero General Public License v3.0.
// See the LICENCE file in the repository root for full licence text.

import Fade from 'fade';

const Blackout = {
  hide: () => Blackout.toggle(false),

  show: () => Blackout.toggle(true),

  toggle: (state: boolean, opacity?: number) => {
    const el = document.querySelector('.js-blackout');

    if (el instanceof HTMLElement) {
      el.style.opacity = !state || opacity == null ? '' : String(opacity);
      Fade.toggle(el, state);
    }
  },
};

export default Blackout;
{'fraction_non_alphanumeric': 0.14472608340147178, 'fraction_numerical': 0.003270645952575634, 'mean_word_length': 3.550185873605948, 'pattern_counts': {'":': 0, '<': 7, '<?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': '3496110', 'n_tokens_mistral': 380, 'n_tokens_neox': 372, 'n_words': 121}