is-furry
TypeScript icon, indicating that this package has built-in type declarations

1.0.7 • Public • Published

is-furry

Checks if a string has "owo" or "uwu" in it (or replaces the matches). Various options and multiple strictness settings from "owo" to "0,w u"

Setup

  • Install the module

    npm install is-furry or using yarn yarn add is-furry

  • Use it in your code
import isFurry from 'is-furry'
// Or using CommonJS
const { default: isFurry } = require('is-furry')

Options

The values shown in this example are the defaults. Custom options will overwrite the defaults.

isFurry('Is this message furry owo', {
    fold: false,
    // Whether to use `fold-to-ascii` to detect more characters,
    foldMode: 'keep',
    /* If set to 'replace', non-ascii characters that could not be turned into ascii will 
       be replaced with the string specified in 'foldReplacement' */
    foldReplacement: '',
    // String to replace unknown characters with (if using 'replace' in 'foldMode')
    outputMode: 'boolean',
    /* Which output mode to use:
       'boolean' - returns either true or false
       'number' - returns the amount of detected words (no overlap)
       'string' - replaces owo or uwu with value specified in 'outputReplacement'. 
       'array' - returns an array of detected words. Empty array if no words are found */
    outputReplacement: '',
    /* String to replace detected words with (if using 'string' in 'outputMode').
       Use '$&' for the matched word (for example, if you want to replace 'owo' 
       with '~~owo~~' you should use '~~$&~~') */
    strictness: 1, 
    /* Strictness ranging from 0 to 2 (more may be coming in the future):
       0 - basic. Detects exactly 'owo' or 'uwu'
       1 - regular. Detects 'owu', 'uwo', '0w0' and such
       2 - strict. Ignores some characters between letters. Will detect '0,,**w**uuuu'
    */
    checkWordBoundaries: true,
    /* Whether to ignore matches that aren't their own word:
       false - would detect 'owo' in 'coworker'
       true - would not detect 'owo' in 'coworker' */
})

Keeping options

If you need to do this a lot, having to include out the options every time is not ideal. It's a better idea to create an object to store your options.

const isFurryOptions = {
    fold: true,
    outputMode: 'replace',
    outputReplacement: '**$&**',
    strictness: 1,
    checkWordBoundaries: true
}

isFurry('message owo', isFurryOptions) // => 'message **owo**'

License

The project is licensed under MIT

Contributing

If you would like to contribute to this package, please read the contributing guide.

Thanks to jakobkg for improving the typings!

Support

Add me on Discord Wait What#497(five)

Package Sidebar

Install

npm i is-furry

Weekly Downloads

0

Version

1.0.7

License

MIT

Unpacked Size

11.9 kB

Total Files

6

Last publish

Collaborators

  • wait_what_