Nearest Phase Modulator

    lookalike-util
    TypeScript icon, indicating that this package has built-in type declarations

    1.3.1 • Public • Published

    lookalike-util

    🥷 🥷 🥷

    Simple, easy to use santizing of strings to remove non-english characters.

    Made with 💖 by StatusPlus



    Table of Contents

    Features

    • Removing Invisible Characters: Easily remove invisible characters from strings!
    • Clearing Lookalikes: Ridding strings of characters that look like normal english letters/chars!
    • Constantly updating Database: Database of lookalikes can update with new ideas!

    Installation

    With npm

    Simply run:

    npm i lookalike-util
    

    That's it! You're good to go!

    With jsDelivr

    In the <head> of your HTML document, add the following:

    <head>
    
    <!-- Other HTML head items -->
    
    <script src="https://cdn.jsdelivr.net/npm/lookalike-util/dist/web/lookalike.js" defer>
    </head>

    You can now reference using lookalikeUtil!

    Compiling from source

    To compile from source, first clone the repository from GitHub:

    git clone https://github.com/Status-Plus/lookalike-util.git
    
    git fetch
    

    Then, install all dependencies:

    npm i
    

    To run the testing suite, run:

    npm test
    

    To build the UMD compatibile package, run:

    npm run build
    

    For lints, run:

    npx eslint . --fix
    

    Examples

    Via npm:

    import { clearSimilar } from '../src/index';
    
    const string = "Êċℎọ!"
    
    console.log(clearSimilar(string)) // returns "Echo!"

    Via HTML

    <!-- snip -->
    
    <script>
      window.lookalikeUtil.clearSimilar('Êċℎọ!'); // returns "Echo!"
    </script>

    API

    clearInvisible(string)

    Returns a string with all "invisible" characters removed. (Not spaces).

    Example:

    lookalikeutil.clearInvisible("i am a ninja⁢⁢⁢⁢!") // returns string w/o invisible characters!

    clearSimilar(string)

    Returns a string with all non-english characters that are abused to look like an english letter to bypass a filter, etc.

    Example:

    lookalikeutil.clearSimilar("Êċℎọ!") // returns "Echo!"

    Usecase

    This is used internally by our team in our Discord bot and similar applications with the purpose of removing sneaky characters that are often abused by bad actors to bypass a filter or make it hard to contact them. Someone could bypass a word filter by using these special characters. This soloves that issue!

    Contributing

    To contribute, please follow the above section regarding compiling from source.

    From there, feel free to work using src/index.js

    If you would like to contibute to the database, please use lib/lookalike.js.

    Before sending a pull request, please ensure tests, lints, and builds pass. Otherwise, CI will not pass!

    License

    This project is open-source under the MIT license:

    https://choosealicense.com/licenses/mit/

    Install

    npm i lookalike-util

    DownloadsWeekly Downloads

    3

    Version

    1.3.1

    License

    MIT

    Unpacked Size

    37.9 kB

    Total Files

    15

    Last publish

    Collaborators

    • fxllencode