Skip to content
This repository has been archived by the owner on Aug 6, 2019. It is now read-only.

Latest commit

 

History

History
47 lines (38 loc) · 945 Bytes

README.md

File metadata and controls

47 lines (38 loc) · 945 Bytes

Migrated to new monorepo: https://github.com/owsas/opensource

detect-link-type

Detects the type of a link, getting the extension of a provided link, in ES2015.

Installation

$> npm i -S detect-link-type

Usage

Typescript

import { Detector } from 'detect-link-type';

Javascript

const { Detector } = require('detect-link-type');

API docs

const LINK = "http://example.com/1/2/3/a.png";

Detector.getExtension(LINK); // "png"
Detector.isImage(LINK); // true
Detector.isPNG(LINK); // true
Detector.isGIF(LINK); // false
Detector.isJPG(LINK); // false
Detector.isCSS(LINK); // false
Detector.isHTML(LINK); // false
Detector.isTTF(LINK); // false
Detector.isJS(LINK); // false
Detector.isPDF(LINK); // false

Credits

Juan Camilo Guarin P
Otherwise SAS
http://owsas.com

LICENSE

MIT

Support us on Patreon

patreon