1
0
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:
Dustin Diaz 2011-05-02 13:33:54 -07:00
parent 1e649921d7
commit 141bf0bcec
4 changed files with 15 additions and 9 deletions

View File

@ -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
View File

@ -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)

View File

@ -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": {

View File

@ -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);