mirror of
https://github.com/lancedikson/bowser
synced 2024-10-27 20:34:22 +00:00
- export browser as an object and not a function
- bump package
This commit is contained in:
parent
1e649921d7
commit
141bf0bcec
10
bowser.js
10
bowser.js
@ -20,9 +20,15 @@
|
|||||||
safari = /safari/i.test(ua) && !chrome,
|
safari = /safari/i.test(ua) && !chrome,
|
||||||
opera = /opera/i.test(ua),
|
opera = /opera/i.test(ua),
|
||||||
firefox = /firefox/i.test(ua),
|
firefox = /firefox/i.test(ua),
|
||||||
gecko = /gecko\//i.test(ua);
|
gecko = /gecko\//i.test(ua),
|
||||||
|
info;
|
||||||
|
|
||||||
function bowser() {
|
function bowser() {
|
||||||
|
info = info ? info : detect();
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
|
||||||
|
function detect() {
|
||||||
|
|
||||||
if (ie) {
|
if (ie) {
|
||||||
return {
|
return {
|
||||||
@ -64,7 +70,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
typeof module !== 'undefined' && module.exports ?
|
typeof module !== 'undefined' && module.exports ?
|
||||||
(module.exports.browser = bowser) :
|
(module.exports.browser = bowser()) :
|
||||||
(context.bowser = bowser);
|
(context.bowser = bowser);
|
||||||
|
|
||||||
}(this);
|
}(this);
|
2
bowser.min.js
vendored
2
bowser.min.js
vendored
@ -4,4 +4,4 @@
|
|||||||
* https://github.com/ded/bowser
|
* https://github.com/ded/bowser
|
||||||
* MIT License
|
* MIT License
|
||||||
*/
|
*/
|
||||||
!function(a){function i(){if(c)return{msie:1,version:b.match(/msie ([\d\.]+);/i)[1]};if(d)return{webkit:1,chrome:1,version:b.match(/chrome\/([\d\.]+)/i)[1]};if(e)return{webkit:1,safari:1,version:b.match(/version\/([\d\.]+)/i)[1]};if(f)return{opera:1,version:b.match(/version\/([\d\.]+)/i)[1]};if(h){var a={gecko:1,version:b.match(/firefox\/([\d\.]+)/i)[1]};g&&(a.firefox=1);return a}}var b=navigator.userAgent,c=/msie/i.test(b),d=/chrome/i.test(b),e=/safari/i.test(b)&&!d,f=/opera/i.test(b),g=/firefox/i.test(b),h=/gecko\//i.test(b);typeof module!="undefined"&&module.exports?module.exports.browser=i:a.bowser=i}(this)
|
!function(a){function k(){if(c)return{msie:1,version:b.match(/msie ([\d\.]+);/i)[1]};if(d)return{webkit:1,chrome:1,version:b.match(/chrome\/([\d\.]+)/i)[1]};if(e)return{webkit:1,safari:1,version:b.match(/version\/([\d\.]+)/i)[1]};if(f)return{opera:1,version:b.match(/version\/([\d\.]+)/i)[1]};if(h){var a={gecko:1,version:b.match(/firefox\/([\d\.]+)/i)[1]};g&&(a.firefox=1);return a}}function j(){i=i?i:k();return i}var b=navigator.userAgent,c=/msie/i.test(b),d=/chrome/i.test(b),e=/safari/i.test(b)&&!d,f=/opera/i.test(b),g=/firefox/i.test(b),h=/gecko\//i.test(b),i;typeof module!="undefined"&&module.exports?module.exports.browser=j():a.bowser=j}(this)
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "bowser",
|
"name": "bowser",
|
||||||
"description": "a browser detector",
|
"description": "a browser detector",
|
||||||
"version": "0.0.1",
|
"version": "0.0.2",
|
||||||
"homepage": "https://github.com/ded/bowser",
|
"homepage": "https://github.com/ded/bowser",
|
||||||
"author": "Dustin Diaz <@ded>",
|
"author": "Dustin Diaz <@ded>",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
@ -18,11 +18,11 @@
|
|||||||
info;
|
info;
|
||||||
|
|
||||||
function bowser() {
|
function bowser() {
|
||||||
info = info ? info : detect();
|
info = info ? info : detect();
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
function detect() {
|
function detect() {
|
||||||
|
|
||||||
if (ie) {
|
if (ie) {
|
||||||
return {
|
return {
|
||||||
@ -64,7 +64,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
typeof module !== 'undefined' && module.exports ?
|
typeof module !== 'undefined' && module.exports ?
|
||||||
(module.exports.browser = bowser) :
|
(module.exports.browser = bowser()) :
|
||||||
(context.bowser = bowser);
|
(context.bowser = bowser);
|
||||||
|
|
||||||
}(this);
|
}(this);
|
Loading…
Reference in New Issue
Block a user