Learn about our RFC process, Open RFC meetings & more.Join in the discussion! »

@pelevesque/have-minimum-occurrences

0.0.4 • Public • Published

Build Status Coverage Status JavaScript Style Guide

have-minimum-occurrences

Checks if substrings occur a minimum number of times in a string.

@see https://www.npmjs.com/package/@pelevesque/have-minimum-density for minimum density.

Node Repository

https://www.npmjs.com/package/@pelevesque/have-minimum-occurrences

Installation

npm install @pelevesque/have-minimum-occurrences

Tests

Standard Style & Unit Tests

npm test

Unit Tests & Coverage

npm run cover

Usage

const haveMinimumOccurrences = require('@pelevesque/have-minimum-occurrences')
const str = 'A little string.'
const checks = [['i', 2]]
const result = haveMinimumOccurrences(str, checks)
// result === true
const str = 'A little string.'
const checks = [['i', 3]]
const result = haveMinimumOccurrences(str, checks)
// result === false
const str = 'A little string.'
const checks = [['i', 2], ['t', 3], [' ', 2]]
const result = haveMinimumOccurrences(str, checks)
// result === true
const str = 'A little string.'
const checks = [['i', 5], ['t', 3], [' ', 2]]
const result = haveMinimumOccurrences(str, checks)
// result === false
const str = 'aab111111aab'
const checks = [['aab', 2]]
const result = haveMinimumOccurrences(str, checks)
// result === true

Install

npm i @pelevesque/have-minimum-occurrences

DownloadsWeekly Downloads

0

Version

0.0.4

License

MIT

Unpacked Size

14 kB

Total Files

7

Last publish

Collaborators

  • avatar