<commit_before>var Class = require('./Class')

var Client = Class(function() {
	
	this.init = function(userAgent) {
		this._userAgent = userAgent
		this._parseClient()
		this._parseOS()
	}
	
	this._parseClient = function() {
		(this.isChrome = this._isClient('Chrome'))
			|| (this.isFirefox = this._isClient('Firefox'))
			|| (this.isIE = this._isClient('MSIE'))
			|| (this.isSafari = this._isClient('Safari', 'Version'))
		
		if (this.isSafari) {
			(this.isIPhone = this._isClient('iPhone', 'Version', true))
				|| (this.isIPad = this._isClient('iPad', 'Version', true))
				|| (this.isIPod = this._isClient('iPod', 'Version', true))
				|| (this.isAndroid = this._isClient('Android', 'Version', true))
		}
	}
	
	this._parseOS = function() {
		if (this.isSafari) {
			this.isIOS = (this.isIPhone || this.isIPad || this.isIPod)
			if (this.isIOS) { this.osVersion = parseFloat(this._userAgent.match(/ OS (\d+_\d+)/)[1].replace('_', '.'), 10) }
		}
		return this
	}
	
	this.isQuirksMode = function(doc) {
		// in IE, if compatMode is undefined (early ie) or explicitly set to BackCompat, we're in quirks
		return this.isIE && (!doc.compatMode || doc.compatMode == 'BackCompat')
	}
	
	this._isClient = function(name, versionString, isMobile) {
		var agent = this._userAgent,
			index = agent.indexOf(name)
		if (index < 0) { return false }
		if (versionString) { index = agent.indexOf(versionString) }
		this.version = parseFloat(agent.substr(index + (versionString || name).length + 1))
		this.name = name
		this.isMobile = isMobile
		return true
	}
	
})

if (typeof window != 'undefined') { module.exports = new Client(window.navigator.userAgent) }
else { module.exports = {} }

module.exports.parse = function(userAgent) { return new Client(userAgent) }<commit_msg>Introduce client.isTablet, and don't assign isMobile to tablets<commit_after>var Class = require('./Class')

var mobileRegex = /mobile/i;

var Client = Class(function() {
	
	this.init = function(userAgent) {
		this._userAgent = userAgent
		this._parseClient()
		this._parseOS()
	}
	
	this._parseClient = function() {
		(this.isChrome = this._isClient('Chrome'))
			|| (this.isFirefox = this._isClient('Firefox'))
			|| (this.isIE = this._isClient('MSIE'))
			|| (this.isSafari = this._isClient('Safari', 'Version'))
		
		if (this.isSafari) {
			(this.isIPhone = this._isClient('iPhone', 'Version'))
				|| (this.isIPad = this._isClient('iPad', 'Version'))
				|| (this.isIPod = this._isClient('iPod', 'Version'))
				|| (this.isAndroid = this._isClient('Android', 'Version'))
		}
		
		if (this.isIPhone || (this.isAndroid && this._userAgent.match(mobileRegex))) {
			this.isMobile = true
		}
		
		this.isTablet = this.isIPad || (this.isAndroid && !this.isMobile)
	}
	
	this._parseOS = function() {
		if (this.isSafari) {
			this.isIOS = (this.isIPhone || this.isIPad || this.isIPod)
			if (this.isIOS) { this.osVersion = parseFloat(this._userAgent.match(/ OS (\d+_\d+)/)[1].replace('_', '.'), 10) }
		}
		return this
	}
	
	this.isQuirksMode = function(doc) {
		// in IE, if compatMode is undefined (early ie) or explicitly set to BackCompat, we're in quirks
		return this.isIE && (!doc.compatMode || doc.compatMode == 'BackCompat')
	}
	
	this._isClient = function(name, versionString) {
		var agent = this._userAgent,
			index = agent.indexOf(name)
		if (index < 0) { return false }
		if (versionString) { index = agent.indexOf(versionString) }
		this.version = parseFloat(agent.substr(index + (versionString || name).length + 1))
		this.name = name
		return true
	}
	
})

if (typeof window != 'undefined') { module.exports = new Client(window.navigator.userAgent) }
else { module.exports = {} }

module.exports.parse = function(userAgent) { return new Client(userAgent) }
{'fraction_non_alphanumeric': 0.16942811330839125, 'fraction_numerical': 0.002672367717797969, 'mean_word_length': 3.9445178335535007, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1390319', 'n_tokens_mistral': 1427, 'n_tokens_neox': 1281, 'n_words': 261}