New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

is-ad

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

is-ad

Function to check if a url contains ads or not.

latest
Source
npmnpm
Version
0.2.1
Version published
Maintainers
1
Created
Source

Contains Ads

is-ad is deprecated, please use contains-ads

Function to check if a url contains ads or not.

$ yarn add contains-ads

Basic Example

import { initialize, containsAds } from 'contains-ads';

// Optionally pass the current url for extra precision.
initialize().then(() => {
  containsAds('http://www.twitter.com');                         // False
  containsAds('http://www.blabal.com&ad_type_');                 // True
  containsAds('http://www.blabal.com&ad_type_', 'sample.com');   // True
});

Advanced Example

import { initialize, containsAds, client } from 'contains-ads';

// You can also parse custom rules. Check the adblock plus docs
// for more information (https://adblockplus.org/filters).
client.parse('||blacklistwebsite.com')
client.parse('@@||whitelistwebsite.com');

initialize().then(() => {
  containsAds('http://www.blacklistwebsite.com');    // True
  containsAds('http://www.whitelistwebsite.com');    // False
});

Development

# Run tests with mocha.
$ yarn test

# Rebuild the blocker/blocked.txt to a buffer.
$ yarn build:detector

Keywords

contains-ad

FAQs

Package last updated on 20 Feb 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts