Micro check library providing comprehensive type checking and validation operations across different JavaScript environments
—
Pending
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
Pending
The risk profile of this skill
Browser and device detection functions for responsive behavior and feature detection. These functions are only available in browser environments.
Checks if the current browser is Chrome with optional version range.
/**
* Checks if current browser is chrome
* @param range - Optional version range (string or number)
* @returns True if current browser is Chrome
* Interfaces: not
*/
function chrome(range?: string | number): boolean;Usage Example:
is.chrome(); // true if current browser is chrome
is.not.chrome(); // false if current browser is chrome
is.chrome(50); // true if current version of chrome is 50
is.chrome('>=40'); // true if current version of chrome is >= 40
is.not.chrome('<30'); // true if current version is not < 30Checks if the current browser is Firefox with optional version range.
/**
* Checks if current browser is firefox
* @param range - Optional version range (string or number)
* @returns True if current browser is Firefox
* Interfaces: not
*/
function firefox(range?: string | number): boolean;Usage Example:
is.firefox(); // true if current browser is firefox
is.firefox(41); // true if current version of firefox is 41
is.firefox('>=40'); // true if current version is >= 40
is.not.firefox('<30'); // true if current version is not < 30Checks if the current browser is Internet Explorer with optional version range.
/**
* Checks if current browser is ie
* @param range - Optional version range (string or number)
* @returns True if current browser is Internet Explorer
* Interfaces: not
*/
function ie(range?: string | number): boolean;Usage Example:
is.ie(); // true if current browser is ie
is.ie(10); // true if current version of ie is 10
is.ie('>=10'); // true if current version is >= 10
is.not.ie('<9'); // true if current version is not < 9Checks if the current browser is Microsoft Edge with optional version range.
/**
* Checks if current browser is edge
* @param range - Optional version range (string or number)
* @returns True if current browser is Edge
* Interfaces: not
*/
function edge(range?: string | number): boolean;Usage Example:
is.edge(); // true if current browser is edge
is.edge(13); // true if current version of edge is 13
is.edge('>=12'); // true if current version is >= 12
is.not.edge('<13'); // true if current version is not < 13Checks if the current browser is Safari with optional version range.
/**
* Checks if current browser is safari
* @param range - Optional version range (string or number)
* @returns True if current browser is Safari
* Interfaces: not
*/
function safari(range?: string | number): boolean;Usage Example:
is.safari(); // true if current browser is safari
is.safari(9); // true if current version of safari is 9
is.safari('>=8'); // true if current version is >= 8
is.not.safari('<7'); // true if current version is not < 7Checks if the current browser is Opera with optional version range.
/**
* Checks if current browser is opera
* @param range - Optional version range (string or number)
* @returns True if current browser is Opera
* Interfaces: not
*/
function opera(range?: string | number): boolean;Usage Example:
is.opera(); // true if current browser is opera
is.opera(36); // true if current version of opera is 36
is.opera('>=35'); // true if current version is >= 35
is.not.opera('<20'); // true if current version is not < 20Checks if the current browser is PhantomJS with optional version range.
/**
* Checks if current browser is phantomjs
* @param range - Optional version range (string or number)
* @returns True if current browser is PhantomJS
* Interfaces: not
*/
function phantom(range?: string | number): boolean;Usage Example:
is.phantom(); // true if current browser is phantomjs
is.phantom(2); // true if current version of phantom is 2
is.phantom('>=1'); // true if current version is >= 1
is.not.phantom('<2'); // true if current version is not < 2Checks for various mobile devices.
/**
* Checks if current device is mobile
* @returns True if device is mobile (iPhone, iPod, Android Phone, Windows Phone, Blackberry)
* Interfaces: not
*/
function mobile(): boolean;
/**
* Checks if current device has ios
* @returns True if current device is iPhone, iPad or iPod
* Interfaces: not
*/
function ios(): boolean;
/**
* Checks if current device is iPhone
* @param range - Optional version range (string or number)
* @returns True if current device is iPhone
* Interfaces: not
*/
function iphone(range?: string | number): boolean;
/**
* Checks if current device is iPad
* @param range - Optional version range (string or number)
* @returns True if current device is iPad
* Interfaces: not
*/
function ipad(range?: string | number): boolean;
/**
* Checks if current device is iPod
* @param range - Optional version range (string or number)
* @returns True if current device is iPod
* Interfaces: not
*/
function ipod(range?: string | number): boolean;Usage Example:
is.mobile(); // true if current device is mobile
is.ios(); // true if current device is iPhone, iPad or iPod
is.iphone(); // true if current device is iPhone
is.iphone(9); // true if current iPhone version is 9
is.ipad(); // true if current device is iPad
is.ipod(); // true if current device is iPodChecks for Android devices.
/**
* Checks if current device has Android
* @returns True if current device has Android OS
* Interfaces: not
*/
function android(): boolean;
/**
* Checks if current device is Android phone
* @returns True if current device is Android phone
* Interfaces: not
*/
function androidPhone(): boolean;
/**
* Checks if current device is Android tablet
* @returns True if current device is Android tablet
* Interfaces: not
*/
function androidTablet(): boolean;Usage Example:
is.android(); // true if current device has Android OS
is.androidPhone(); // true if current device is Android phone
is.androidTablet(); // true if current device is Android tabletChecks for other device types.
/**
* Checks if current device is Blackberry
* @returns True if current device is Blackberry
* Interfaces: not
*/
function blackberry(): boolean;
/**
* Checks if current device is Windows phone
* @returns True if current device is Windows phone
* Interfaces: not
*/
function windowsPhone(): boolean;
/**
* Checks if current device is Windows tablet
* @returns True if current device is Windows tablet
* Interfaces: not
*/
function windowsTablet(): boolean;
/**
* Checks if current device is tablet
* @returns True if device is tablet (iPad, Android Tablet, Windows Tablet)
* Interfaces: not
*/
function tablet(): boolean;
/**
* Checks if current device is desktop
* @returns True if current device is desktop
* Interfaces: not
*/
function desktop(): boolean;Checks for different operating systems.
/**
* Checks if current OS is Windows
* @returns True if current OS is Windows
* Interfaces: not
*/
function windows(): boolean;
/**
* Checks if current OS is Mac OS X
* @returns True if current OS is Mac OS X
* Interfaces: not
*/
function mac(): boolean;
/**
* Checks if current OS is linux
* @returns True if current OS is linux
* Interfaces: not
*/
function linux(): boolean;Usage Example:
is.windows(); // true if current OS is Windows
is.mac(); // true if current OS is Mac OS X
is.linux(); // true if current OS is linuxChecks for network status and device capabilities.
/**
* Checks if current device is online
* @returns True if current device is online
* Interfaces: not
*/
function online(): boolean;
/**
* Checks if current device is offline
* @returns True if current device is offline
* Interfaces: not
*/
function offline(): boolean;
/**
* Checks if current device supports touch
* @returns True if current device supports touch
* Interfaces: not
*/
function touchDevice(): boolean;Usage Example:
is.online(); // true if current device is online
is.offline(); // true if current device is offline
is.touchDevice(); // true if current device supports touch