Permalink
Browse files

initial commit

  • Loading branch information...
0 parents commit 206d8c829889582137f8879c737a07bef5c15b87 @juliangruber committed Aug 7, 2013
Showing with 97 additions and 0 deletions.
  1. +1 −0 .gitignore
  2. +52 −0 README.md
  3. +6 −0 index.js
  4. +30 −0 package.json
  5. +8 −0 test.js
@@ -0,0 +1 @@
+node_modules
@@ -0,0 +1,52 @@
+
+# is-mobile
+
+Check if mobile browser, based on useragent string.
+
+## Example
+
+```js
+var mobile = require('is-mobile');
+
+console.log(mobile(navigator.userAgent));
+// => false
+```
+
+## Installation
+
+With [npm](https://npmjs.org) do:
+
+```bash
+npm install is-mobile
+```
+
+Bundle for the browser with
+[browserify](https://github.com/substack/node-browserify).
+
+## Kudos
+
+Taken from [detectmobilebrowsers.com](http://detectmobilebrowsers.com/).
+
+## License
+
+(MIT)
+
+Copyright (c) 2013 Julian Gruber <julian@juliangruber.com>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -0,0 +1,30 @@
+{
+ "name": "is-mobile",
+ "description": "Check if mobile browser.",
+ "version": "0.0.0",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/juliangruber/is-mobile.git"
+ },
+ "homepage": "https://github.com/juliangruber/is-mobile",
+ "main": "index.js",
+ "scripts": {
+ "test": "tape test.js"
+ },
+ "dependencies": {},
+ "devDependencies": {
+ "tape": "~1.0.4"
+ },
+ "keywords": [
+ "mobile",
+ "desktop",
+ "check",
+ "browser"
+ ],
+ "author": {
+ "name": "Julian Gruber",
+ "email": "mail@juliangruber.com",
+ "url": "http://juliangruber.com"
+ },
+ "license": "MIT"
+}
@@ -0,0 +1,8 @@
+var test = require('tape');
+var isMobile = require('./');
+
+test('is mobile', function (t) {
+ t.ok(isMobile('Mozilla/5.0 (iPhone; CPU iPhone OS 5_0 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9A334 Safari/7534.48.3'));
+ t.notOk(isMobile('Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.95 Safari/537.36'));
+ t.end();
+});

0 comments on commit 206d8c8

Please sign in to comment.