Giter Site home page Giter Site logo

brianmitchl / yeehaw-matcher Goto Github PK

View Code? Open in Web Editor NEW
2.0 3.0 1.0 123 KB

๐Ÿค  Test that a string contains permutations of a yeehaw.

Home Page: https://www.npmjs.com/package/yeehaw-matcher

License: ISC License

TypeScript 97.93% Shell 2.07%
regexp yeehaw text

yeehaw-matcher's Introduction

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

yeehaw-matcher's People

Contributors

brianmitchl avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

yeehaw-matcher's Issues

"Have Heard" returns true

The string "Have heard" is returning true. However this string is not very yee haw like.

Expected behavior: this string returns false.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.