Home

Awesome

is-badge

Build Coverage Downloads Size

Check if url is a badge.

Contents

What is this?

This is a tiny package that checks if a given url points to a badge.

When should I use this?

You can use this package for example to filter out badges.

Install

This package is ESM only. In Node.js (version 14.14+, 16.0+), install with npm:

npm install is-badge

In Deno with esm.sh:

import {isBadge} from 'https://esm.sh/is-badge@2'

In browsers with esm.sh:

<script type="module">
  import {isBadge} from 'https://esm.sh/is-badge@2?bundle'
</script>

Use

import {isBadge} from 'is-badge'

isBadge('https://img.shields.io/travis/joyent/node.svg') // => true
isBadge('https://example.com') // => false

API

This package exports the identifier isBadge. There is no default export.

isBadge(url)

Check if url is a badge.

Data

This project supports:

Types

This package is fully typed with TypeScript. It exports no additional types.

Compatibility

This package is at least compatible with all maintained versions of Node.js. As of now, that is Node.js 14.14+ and 16.0+. It also works in Deno and modern browsers.

Contribute

Yes please! See How to Contribute to Open Source.

Security

This package is safe.

License

MIT © Titus Wormer

<!-- Definitions -->