<commit_before>/**
 * String polyfill / shims
 *
 * (c) copyright 2011-2012 <NAME> and <NAME>
 *
 * This module is part of the cujo.js family of libraries (http://cujojs.com/).
 *
 * Licensed under the MIT License at:
 * 		http://www.opensource.org/licenses/mit-license.php
 *
 */
define (['./_base', 'exports'], function (base, exports) {
	"use strict";

	var alreadyShimmed = false,
		methods = {},
		missing = {},
		proto = String.prototype,
		featureMap;

	featureMap = {
		'trim': 'trim',
		'trimleft': 'trimLeft',
		'trimright': 'trimRight'
	};

	function has (feature) {
		var prop = featureMap[feature];
		return base.isFunction(proto[prop]);
	}

	var trimRightRx = /\s+$/,
		trimLeftRx = /^\s+/;

	function trim () {
		return this.trimLeft().trimRight();
	}

	function trimLeft () {
		return this.replace(trimLeftRx, '');
	}

	function trimRight () {
		return this.replace(trimRightRx, '');
	}

	methods.trim = trim;
	if (!has('string-trim')) {
		missing.trim = trim;
	}
	methods.trimLeft = trimLeft;
	if (!has('string-trimleft')) {
		missing.trimLeft = trimLeft;
	}
	methods.trimRight = trimRight;
	if (!has('string-trimright')) {
		missing.trimRight = trimRight;
	}

	base.addWrappers(methods, proto, exports);

	exports['polyfill'] = function () {
		if (!alreadyShimmed) {
			base.addShims(missing, proto);
			alreadyShimmed = true;
		}
	};

});
<commit_msg>no longer augments prototype in engines that don't need it<commit_after>/**
 * String polyfill / shims
 *
 * (c) copyright 2011-2012 <NAME> and <NAME>
 *
 * This module is part of the cujo.js family of libraries (http://cujojs.com/).
 *
 * Licensed under the MIT License at:
 * 		http://www.opensource.org/licenses/mit-license.php
 *
 */
define (['./_base', 'exports'], function (base, exports) {
	"use strict";

	var alreadyShimmed = false,
		methods = {},
		missing = {},
		proto = String.prototype,
		featureMap;

	featureMap = {
		'string-trim': 'trim',
		'string-trimleft': 'trimLeft',
		'string-trimright': 'trimRight'
	};

	function has (feature) {
		var prop = featureMap[feature];
		return base.isFunction(proto[prop]);
	}

	var trimRightRx = /\s+$/,
		trimLeftRx = /^\s+/;

	function trim () {
		return this.trimLeft().trimRight();
	}

	function trimLeft () {
		return this.replace(trimLeftRx, '');
	}

	function trimRight () {
		return this.replace(trimRightRx, '');
	}

	methods.trim = trim;
	if (!has('string-trim')) {
		missing.trim = trim;
	}
	methods.trimLeft = trimLeft;
	if (!has('string-trimleft')) {
		missing.trimLeft = trimLeft;
	}
	methods.trimRight = trimRight;
	if (!has('string-trimright')) {
		missing.trimRight = trimRight;
	}

	base.addWrappers(methods, proto, exports);

	exports['polyfill'] = function () {
		if (!alreadyShimmed) {
			base.addShims(missing, proto);
			alreadyShimmed = true;
		}
	};

});

{'fraction_non_alphanumeric': 0.17034925160370634, 'fraction_numerical': 0.005702066999287242, 'mean_word_length': 3.6550580431177444, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '2908136', 'n_tokens_mistral': 1065, 'n_tokens_neox': 976, 'n_words': 219}