<commit_before>/** @jsx createElement */
import {createElement, Phrase} from 'lacona-phrase'
import _ from 'lodash'

export default class DigitString extends Phrase {
  filter (input) {
    if (!/^[0-9]+$/.test(input)) return false

    if (input.length > this.props.maxLength) return false
    if (input.length < this.props.minLength) return false

    if (!this.props.allowLeadingZeros && input !== '0' && _.startsWith(input, '0')) return false

    const intValue = parseInt(input, 10)
    if (isNaN(intValue)) return false
    if (intValue > this.props.max) return false
    if (intValue < this.props.min) return false

    return true
  }

  suppressWhen (input) {
    if (!/^\d*$/.test(input)) return false

    if (input.length > this.props.maxLength) return false
    if (!this.props.allowLeadingZeros && input !== '0' && _.startsWith(input, '0')) return false

    const intValue = parseInt(input, 10)
    if (intValue > this.props.max) return false

    const lowestOneMoreDigit = `${input}0`
    if (lowestOneMoreDigit.length > this.props.maxLength) return false
    
    const lowestOneMoreDigitIntValue = parseInt(lowestOneMoreDigit, 10)
    if (lowestOneMoreDigitIntValue > this.props.max) return false

    return true
  }

  describe () {
    return (
      <label text={this.props.argument} suppressWhen={this.suppressWhen.bind(this)}>
        <freetext filter={this.filter.bind(this)} splitOn={/\D/} score={1} />
      </label>
    )
  }
}
DigitString.defaultProps = {
  minLength: 0,
  maxLength: 9007199254740991,
  min: 0,
  max: 9007199254740991,
  allowLeadingZeros: true,
  argument: 'number'
}
<commit_msg>Increase default maxLength of DigitString to 1<commit_after>/** @jsx createElement */
import {createElement, Phrase} from 'lacona-phrase'
import _ from 'lodash'

export default class DigitString extends Phrase {
  filter (input) {
    if (!/^[0-9]+$/.test(input)) return false

    if (input.length > this.props.maxLength) return false
    if (input.length < this.props.minLength) return false

    if (!this.props.allowLeadingZeros && input !== '0' && _.startsWith(input, '0')) return false

    const intValue = parseInt(input, 10)
    if (isNaN(intValue)) return false
    if (intValue > this.props.max) return false
    if (intValue < this.props.min) return false

    return true
  }

  suppressWhen (input) {
    if (!/^\d*$/.test(input)) return false

    if (input.length > this.props.maxLength) return false
    if (!this.props.allowLeadingZeros && input !== '0' && _.startsWith(input, '0')) return false

    const intValue = parseInt(input, 10)
    if (intValue > this.props.max) return false

    const lowestOneMoreDigit = `${input}0`
    if (lowestOneMoreDigit.length > this.props.maxLength) return false

    const lowestOneMoreDigitIntValue = parseInt(lowestOneMoreDigit, 10)
    if (lowestOneMoreDigitIntValue > this.props.max) return false

    return true
  }

  describe () {
    return (
      <label text={this.props.argument} suppressWhen={this.suppressWhen.bind(this)}>
        <freetext filter={this.filter.bind(this)} splitOn={/\D/} score={1} />
      </label>
    )
  }
}
DigitString.defaultProps = {
  minLength: 1,
  maxLength: 9007199254740991,
  min: 0,
  max: 9007199254740991,
  allowLeadingZeros: true,
  argument: 'number'
}

{'fraction_non_alphanumeric': 0.13248252810695837, 'fraction_numerical': 0.02947432391370404, 'mean_word_length': 3.5658807212205272, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 21, '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': '7444778', 'n_tokens_mistral': 1156, 'n_tokens_neox': 1084, 'n_words': 268}