<commit_before>'use strict';

const { Maybe, isClientSide } = require('../lib/utils');

module.exports = (config) => {
	const intercomTracker = {};
	const now = () => Math.round((new Date()).getTime() / 1000);
	const intercomMapKeys = (options) => {
		const keys = {
			appId: 'app_id',
			name: 'name',
			email: 'email'
		};

		return Object.keys(keys).reduce((object, key) => {
			object[keys[key]] = options[key];
			return object;
		}, { created_at: now() });
	};

	const Intercom = (() => {
		let ic = () => '';

		/* istanbul ignore if */
		if(isClientSide) {
			ic = window.Intercom;
			window.Intercom = undefined;
		}

		return ic;
	})();

	Intercom('boot', Maybe(intercomMapKeys(config)));

	intercomTracker.update = (options) => {
		Intercom('update', Maybe(options));
		return intercomTracker;
	};
<commit_msg>Pass now to utils<commit_after>'use strict';

const { Maybe, isClientSide, intercomCreatedAt } = require('../lib/utils');

module.exports = (config) => {
	const intercomTracker = {};
	const intercomMapKeys = (options) => {
		const keys = {
			appId: 'app_id',
			name: 'name',
			email: 'email'
		};

		return Object.keys(keys).reduce((object, key) => {
			object[keys[key]] = options[key];
			return object;
		}, { created_at: intercomCreatedAt() });
	};

	const Intercom = (() => {
		let ic = () => '';

		/* istanbul ignore if */
		if(isClientSide) {
			ic = window.Intercom;
			window.Intercom = undefined;
		}

		return ic;
	})();

	Intercom('boot', Maybe(intercomMapKeys(config)));

	intercomTracker.update = (options) => {
		Intercom('update', Maybe(options));
		return intercomTracker;
	};

{'fraction_non_alphanumeric': 0.19000616903146206, 'fraction_numerical': 0.0024676125848241827, 'mean_word_length': 3.7151162790697674, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 16, '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': '1163132', 'n_tokens_mistral': 618, 'n_tokens_neox': 552, 'n_words': 113}