yukari-util
    Preparing search index...

    Function includesWithRatio

    • 指定したパターンが文字列中に占める割合が、しきい値以上かどうかを判定する関数

      Parameters

      • text: string

        調べる対象の文字列

      • pattern: string

        検索する文字列

      • ratioThreshold: number

        しきい値(例: 0.2 は20%)

      Returns boolean

      pattern が text の中で ratioThreshold 以上の割合を占めていれば true、それ以外は false

      includesWithRatio("aaaaatextaaaaa", "text", 0.6) // false
      includesWithRatio("atexta", "text", 0.6) // true