<commit_before>/**
 * jsFrontend Battery API
 *
 * @author <NAME> <<EMAIL>>
 */
jsFrontendBatteryAPI =
{
	battery: false,
	init: function()
	{
		// get the battery
		battery = navigator.battery || navigator.webkitBattery || navigator.mozBattery;

		// redefine core battery
		if(battery != 'undefined') jsFrontendBatteryAPI.battery = battery;
	},

	/**
	 * Is charging
	 *
	 * @return bool
	 */
	isCharging: function()
	{
		return (jsFrontendBatteryAPI.hasBattery()) ? jsFrontendBatteryAPI.battery.charging : false;
	},

	/**
	 * Is supported
	 *
	 * @return bool
	 */
	isSupported: function()
	{
		return !!(jsFrontendBatteryAPI.battery);
	},

	/**
	 * Get charging time
	 *
	 * @return float
	 */
	getChargingTime: function()
	{
		return (jsFrontendBatteryAPI.hasBattery()) ? jsFrontendBatteryAPI.battery.chargingTime : 0;	
	},

	/**
	 * Get discharging time
	 *
	 * @return float
	 */
	getDischargingTime: function()
	{
		return (jsFrontendBatteryAPI.hasBattery()) ? jsFrontendBatteryAPI.battery.dischargingTime : 0;	
	},

	/**
	 * Get level
	 *
	 * @return float
	 */
	getLevel: function()
	{
		return (jsFrontendBatteryAPI.hasBattery()) ? jsFrontendBatteryAPI.battery.level : 0;	
	}
}

$(jsFrontendBatteryAPI.init);<commit_msg>hasBattery() renamed to isSupported()<commit_after>/**
 * jsFrontend Battery API
 *
 * @author <NAME> <<EMAIL>>
 */
jsFrontendBatteryAPI =
{
	battery: false,
	init: function()
	{
		// get the battery
		battery = navigator.battery || navigator.webkitBattery || navigator.mozBattery;

		// redefine core battery
		if(battery != 'undefined') jsFrontendBatteryAPI.battery = battery;
	},

	/**
	 * Is charging
	 *
	 * @return bool
	 */
	isCharging: function()
	{
		return (jsFrontendBatteryAPI.isSupported()) ? jsFrontendBatteryAPI.battery.charging : false;
	},

	/**
	 * Is supported
	 *
	 * @return bool
	 */
	isSupported: function()
	{
		return !!(jsFrontendBatteryAPI.battery);
	},

	/**
	 * Get charging time
	 *
	 * @return float
	 */
	getChargingTime: function()
	{
		return (jsFrontendBatteryAPI.isSupported()) ? jsFrontendBatteryAPI.battery.chargingTime : 0;	
	},

	/**
	 * Get discharging time
	 *
	 * @return float
	 */
	getDischargingTime: function()
	{
		return (jsFrontendBatteryAPI.isSupported()) ? jsFrontendBatteryAPI.battery.dischargingTime : 0;	
	},

	/**
	 * Get level
	 *
	 * @return float
	 */
	getLevel: function()
	{
		return (jsFrontendBatteryAPI.isSupported()) ? jsFrontendBatteryAPI.battery.level : 0;	
	}
}

$(jsFrontendBatteryAPI.init);
{'fraction_non_alphanumeric': 0.14285714285714285, 'fraction_numerical': 0.002407704654895666, 'mean_word_length': 3.668539325842697, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '3654736', 'n_tokens_mistral': 957, 'n_tokens_neox': 870, 'n_words': 156}