Nanoseconds Produce Minutes
    Wondering what’s next for npm?Check out our public roadmap! »

    yeehaw-matcher
    TypeScript icon, indicating that this package has built-in type declarations

    2.0.0 • Public • Published

    yeehaw-matcher 🤠

    Test that a string contains permutations of a yeehaw.

    This module exports a named RegExp, yeehaw. A string will match a "yeehaw" if there are two words, optionally separated by non-word characters. A word is a string that starts with a 'y' or an 'h', followed by some variation of 'ee', 'aw', or 'ah' (at least one of each character is required).

    There is a second RegExp, yeehawAll that can be used with String.prototype.match to find all "yee haws" in a string.

    Example

    const { yeehaw, yeehawAll } = require('yeehaw-matcher');
    
    yeehaw.test('yeehaw'); // true
    yeehaw.test('yee haw'); // true
    yeehaw.test('hee haw'); // true
    yeehaw.test('boo, no fun'); // false
    yeehaw.test('yehaw'); // false
    yeehaw.test('yeeha'); // false
    yeehaw.test('yh'); // false
    
    'yee haw hee haw hee yah'.match(yeehawAll); // ['yee haw', 'hee haw', 'hee yah']

    See the test file for more examples of valid and invalid strings.

    Inspiration

    Brandon Johnson's yeehaw table.

    Lawful Neutral Chaotic
    Good yeehaw heeyaw yeeyaw
    Neutral yeeyee hawhaw yahyah
    Evil hawyee yawhee heehaw

    Keywords

    Install

    npm i yeehaw-matcher

    DownloadsWeekly Downloads

    5

    Version

    2.0.0

    License

    ISC

    Unpacked Size

    4.49 kB

    Total Files

    5

    Last publish

    Collaborators

    • avatar