@finsweet/ts-utils
Version:
Typescript utils for custom Webflow projects.
61 lines (60 loc) • 2.08 kB
JavaScript
/**
* @returns `true` if the target is an instance of File type.
* @param target
*/
export const isFile = (target) => target instanceof File;
/**
* @returns `true` if the target is an instance of Node type.
* @param target
*/
export const isNode = (target) => target instanceof Node;
/**
* @returns `true` if the target is an instance of Element type.
* @param target
*/
export const isElement = (target) => target instanceof Element;
/**
* @returns `true` if the target is an instance of HTMLElement type.
* @param target
*/
export const isHTMLElement = (target) => target instanceof HTMLElement;
/**
* @returns `true` if the target is an instance of HTMLInputElement type.
* @param target
*/
export const isHTMLInputElement = (target) => target instanceof HTMLInputElement;
/**
* @returns `true` if the target is an instance of HTMLSelectElement type.
* @param target
*/
export const isHTMLSelectElement = (target) => target instanceof HTMLSelectElement;
/**
* @returns `true` if the target is an instance of HTMLTextAreaElement type.
* @param target
*/
export const isHTMLTextAreaElement = (target) => target instanceof HTMLTextAreaElement;
/**
* @returns `true` if the target is an instance of HTMLVideoElement type.
* @param target
*/
export const isHTMLVideoElement = (target) => target instanceof HTMLVideoElement;
/**
* @returns `true` if the target is an instance of HTMLAnchorElement type.
* @param target
*/
export const isHTMLAnchorElement = (target) => target instanceof HTMLAnchorElement;
/**
* @returns `true` if the target is an instance of HTMLImageElement type.
* @param target
*/
export const isHTMLImageElement = (target) => target instanceof HTMLImageElement;
/**
* @returns `true` if the target is an instance of HTMLOptionElement type.
* @param target
*/
export const isHTMLOptionElement = (target) => target instanceof HTMLOptionElement;
/**
* @returns `true` if the target is an instance of HTMLButtonElement type.
* @param target
*/
export const isHTMLButtonElement = (target) => target instanceof HTMLButtonElement;