string-flagger

1.0.2 • Public • Published

Basic way of flagging strings if they contain blacklisted strings or domains.

const {filterUrls, filter} = require("string-flagger");

let blockedDomains = [
    "google.com"
]

async function asyncTest(){
    console.log(`Expected true. Result: ${await filterUrls('This should flag -> https://google.com', blockedDomains)}`)
    console.log(`Expected false. Result: ${await filterUrls('This should not flag -> https://google2.com', blockedDomains)}`)
}

function test(){
    filterUrls('This should flag -> https://google.com', blockedDomains).then(r => {
        console.log(`Expected true. Result:  ${r}`)
    })
    filterUrls('This should not flag -> https://google2.com', blockedDomains).then(r => {
        console.log(`Expected false. Result:  ${r}`)
    })
}

asyncTest()
test()

/string-flagger/

    Package Sidebar

    Install

    npm i string-flagger

    Weekly Downloads

    12

    Version

    1.0.2

    License

    ISC

    Unpacked Size

    2.03 kB

    Total Files

    3

    Last publish

    Collaborators

    • m1nx