diff --git a/types/is/index.d.ts b/types/is/index.d.ts index 37b485e0a0..9129f7d664 100644 --- a/types/is/index.d.ts +++ b/types/is/index.d.ts @@ -1,8 +1,10 @@ // Type definitions for is.js // Project: http://arasatasaygin.github.io/is.js/ -// Definitions by: Rodrigo Cabral +// Definitions by: Rodrigo Cabral , Mitchell Grice // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +type EnvironmentVersionRange = number | string; + interface IsStatic { //#region Type checks @@ -367,29 +369,45 @@ interface IsStatic { /** * Checks if current browser is ie - * @parm value Optional version number of browser + * @parm value Optional version range of browser */ - ie(value?: number): boolean; + ie(range?: EnvironmentVersionRange): boolean; /** * Checks if current browser is chrome. + * @parm value Optional version range of browser */ - chrome(): boolean; + chrome(range?: EnvironmentVersionRange): boolean; /** * Checks if current browser is firefox. + * @parm value Optional version range of browser */ - firefox(): boolean; + firefox(range?: EnvironmentVersionRange): boolean; + + /** + * Checks if current browser is edge. + * @parm value Optional version range of browser + */ + edge(range?: EnvironmentVersionRange): boolean; /** * Checks if current browser is opera. + * @parm value Optional version range of browser */ - opera(): boolean; + opera(range?: EnvironmentVersionRange): boolean; /** * Checks if current browser is safari. + * @parm value Optional version range of browser */ - safari(): boolean; + safari(range?: EnvironmentVersionRange): boolean; + + /** + * Checks if current browser is phantom. + * @parm value Optional version range of browser + */ + phantom(range?: EnvironmentVersionRange): boolean; /** * Checks if current device has ios. @@ -398,18 +416,21 @@ interface IsStatic { /** * Checks if current device is iPhone. + * @parm value Optional version range of device */ - iphone(): boolean; + iphone(range?: EnvironmentVersionRange): boolean; /** * Checks if current device is iPad. + * @parm value Optional version range of device */ - ipad(): boolean; + ipad(range?: EnvironmentVersionRange): boolean; /** * Checks if current device is iPod. + * @parm value Optional version range of device */ - ipod(): boolean; + ipod(range?: EnvironmentVersionRange): boolean; /** * Checks if current device has Android. @@ -481,6 +502,11 @@ interface IsStatic { */ offline(): boolean; + /** + * Checks if current device supports touch. + */ + touchDevice(): boolean; + //#endregion //#region Time checks diff --git a/types/is/is-tests.ts b/types/is/is-tests.ts index 77a88a81b3..6f27fd4b7b 100644 --- a/types/is/is-tests.ts +++ b/types/is/is-tests.ts @@ -446,32 +446,67 @@ is.all.sorted([[1, 2], [5, 4]]); //#region Environment checks is.ie(); -is.ie(6); is.not.ie(); +is.ie(10); +is.ie('>=10'); +is.not.ie('<9'); is.chrome(); is.not.chrome(); +is.chrome(50); +is.chrome('>=40'); +is.not.chrome('<30'); is.firefox(); is.not.firefox(); +is.firefox(41); +is.firefox('>=40'); +is.not.firefox('<30'); + +is.edge(); +is.not.edge(); +is.edge(13); +is.edge('>=12'); +is.not.edge('<13'); is.opera(); is.not.opera(); +is.opera(36); +is.opera('>=35'); +is.not.opera('<20'); is.safari(); is.not.safari(); +is.safari(9); +is.safari('>=8'); +is.not.safari('<7'); + +is.phantom(); +is.not.phantom(); +is.phantom(2); +is.phantom('>=1'); +is.not.phantom('<2'); is.ios(); is.not.ios(); is.iphone(); is.not.iphone(); +is.iphone(9); +is.iphone('>=7'); +is.not.iphone('<8'); is.ipad(); is.not.ipad(); +is.ipad(9); +is.ipad('>=7'); +is.not.ipad('<8'); is.ipod(); is.not.ipod(); +is.ipod(7); +is.ipod('>=5'); +is.not.ipod('<5'); is.android(); is.not.android(); @@ -483,7 +518,6 @@ is.androidTablet(); is.not.androidTablet(); is.blackberry(); - is.not.blackberry(); is.windowsPhone(); @@ -516,6 +550,9 @@ is.not.online(); is.offline(); is.not.offline(); +is.touchDevice(); +is.not.touchDevice(); + //#endregion //#region Time checks @@ -664,4 +701,4 @@ is.url('quack'); var customName = is.setNamespace(); customName.odd(3); -//#endregion \ No newline at end of file +//#endregion