ismobilejs: Provides its own types (#39592)

This commit is contained in:
Alexander T
2019-11-01 10:48:01 -07:00
committed by Jesse Trinity
parent 01f88afb81
commit 43b33863ca
5 changed files with 6 additions and 101 deletions
+6
View File
@@ -1950,6 +1950,12 @@
"sourceRepoURL": "https://github.com/sindresorhus/is-url-superb",
"asOfVersion": "3.0.0"
},
{
"libraryName": "ismobilejs",
"typingsPackageName": "ismobilejs",
"sourceRepoURL": "https://github.com/kaimallea/isMobile",
"asOfVersion": "1.0.0"
},
{
"libraryName": "issue-regex",
"typingsPackageName": "issue-regex",
-57
View File
@@ -1,57 +0,0 @@
// Type definitions for ismobilejs 0.4
// Project: https://github.com/kaimallea/isMobile
// Definitions by: Maksim Karelov <https://github.com/Ty3uK>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
interface Apple {
phone: boolean;
ipod: boolean;
tablet: boolean;
device: boolean;
}
interface Android {
phone: boolean;
tablet: boolean;
device: boolean;
}
interface Amazon {
phone: boolean;
tablet: boolean;
device: boolean;
}
interface Windows {
phone: boolean;
tablet: boolean;
device: boolean;
}
interface Other {
blackberry_10: boolean;
blackberry: boolean;
opera: boolean;
firefox: boolean;
chrome: boolean;
device: boolean;
}
interface IsMobile {
any: boolean;
phone: boolean;
tablet: boolean;
seven_inch: boolean;
apple: Apple;
android: Android;
amazon: Amazon;
windows: Windows;
other: Other;
(userAgent?: string): IsMobile;
}
declare const isMobile: IsMobile;
export = isMobile;
-19
View File
@@ -1,19 +0,0 @@
import * as isMobile from 'ismobilejs';
const MOZILLA_ANDROID_UA = 'Mozilla/5.0 (Android 4.4; Mobile; rv:41.0) Gecko/41.0 Firefox/41.0';
const MOZILLA_IPHONE_UA = 'Mozilla/5.0 (iPhone; CPU iPhone OS 8_3 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) FxiOS/1.0 Mobile/12F69 Safari/600.1.4';
const CHROME_ANDROID_UA = 'Mozilla/5.0 (Linux; Android 8.0.0; Pixel Build/OPP3.170518.006) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.66 Mobile Safari/537.36';
const CHROME_IPHONE_UA = 'Mozilla/5.0 (iPhone; CPU iPhone OS 10_3 like Mac OS X) AppleWebKit/602.1.50 (KHTML, like Gecko) CriOS/56.0.2924.75 Mobile/14E5239e Safari/602.1';
// $ExpectType boolean
isMobile(MOZILLA_ANDROID_UA).android.phone;
// $ExpectType boolean
isMobile(MOZILLA_IPHONE_UA).apple.phone;
// $ExpectType boolean
isMobile(CHROME_ANDROID_UA).android.phone;
// $ExpectType boolean
isMobile(CHROME_IPHONE_UA).apple.phone;
console.log(isMobile.apple);
-24
View File
@@ -1,24 +0,0 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"ismobilejs-tests.ts"
]
}
-1
View File
@@ -1 +0,0 @@
{ "extends": "dtslint/dt.json" }