<commit_before>// @flow weak

import React, { Component } from 'react';
import EventListener from 'react-event-listener';
import createHelper from 'recompose/createHelper';
import createEagerFactory from 'recompose/createEagerFactory';
import customPropTypes from '../utils/customPropTypes';
import { keys } from '../styles/breakpoints';

/**
 * By default, returns true if screen width is the same or greater than the given breakpoint.
 * @param screenWidth
 * @param breakpoint
 * @param inclusive - defaults to true
 */
export const isWidthUp = (screenWidth, breakpoint, inclusive = true) => {
  if (inclusive) {
    return keys.indexOf(screenWidth) <= keys.indexOf(breakpoint);
  }
  return keys.indexOf(screenWidth) < keys.indexOf(breakpoint);
};

/**
 * By default, returns true if screen width is the same or less than the given breakpoint.
 * @param screenWidth
 * @param breakpoint
 * @param inclusive - defaults to true
 */
export const isWidthDown = (screenWidth, breakpoint, inclusive = true) => {
  if (inclusive) {
    return keys.indexOf(screenWidth) >= keys.indexOf(breakpoint);
  }
  return keys.indexOf(screenWidth) > keys.indexOf(breakpoint);
};

function withWidth(options = {}) {
  const {
    resizeInterval = 166, // Corresponds to 10 frames at 60 Hz.
  } = options;

  return (BaseComponent) => {
    const factory = createEagerFactory(BaseComponent);

    return class WithWidth extends Component {
      static contextTypes = {
        theme: customPropTypes.muiRequired,<commit_msg>[withWidth] keep left and right sides the same for comparison comprehension on helper functions<commit_after>// @flow weak

import React, { Component } from 'react';
import EventListener from 'react-event-listener';
import createHelper from 'recompose/createHelper';
import createEagerFactory from 'recompose/createEagerFactory';
import customPropTypes from '../utils/customPropTypes';
import { keys } from '../styles/breakpoints';

/**
 * By default, returns true if screen width is the same or greater than the given breakpoint.
 * @param screenWidth
 * @param breakpoint
 * @param inclusive - defaults to true
 */
export const isWidthUp = (breakpoint, screenWidth, inclusive = true) => {
  if (inclusive) {
    return keys.indexOf(breakpoint) <= keys.indexOf(screenWidth);
  }
  return keys.indexOf(breakpoint) < keys.indexOf(screenWidth);
};

/**
 * By default, returns true if screen width is the same or less than the given breakpoint.
 * @param screenWidth
 * @param breakpoint
 * @param inclusive - defaults to true
 */
export const isWidthDown = (breakpoint, screenWidth, inclusive = true) => {
  if (inclusive) {
    return keys.indexOf(screenWidth) <= keys.indexOf(breakpoint);
  }
  return keys.indexOf(screenWidth) < keys.indexOf(breakpoint);
};

function withWidth(options = {}) {
  const {
    resizeInterval = 166, // Corresponds to 10 frames at 60 Hz.
  } = options;

  return (BaseComponent) => {
    const factory = createEagerFactory(BaseComponent);

    return class WithWidth extends Component {
      static contextTypes = {
        theme: customPropTypes.muiRequired,
{'fraction_non_alphanumeric': 0.10709677419354839, 'fraction_numerical': 0.004516129032258065, 'mean_word_length': 4.291808873720137, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 11, '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': '3706184', 'n_tokens_mistral': 862, 'n_tokens_neox': 837, 'n_words': 282}