<commit_before>/**
 * curl (cujo resource loader)
 *
 * (c) copyright 2011, unscriptable.com
 * 
 */

// TODO: code documentation!!!
// TODO: packages
// TODO: commonjs exports and module dependencies
// TODO: finish debug plugin

var curl, require, define;
(function (global, doc) {

	/*
	 * Overall operation:
	 * When a dependency is encountered and it already exists, it's returned.
	 * If it doesn't already exist, it is created and the dependency's script
	 * is loaded. If there is a define call in the loaded script with a name,
	 * it is resolved asap (i.e. as soon as the dependency's dependencies are
	 * resolved). If there is a (single) define call with no name (anonymous),
	 * the resource in the resNet is resolved after the script's onload fires.
	 * IE requires a slightly different tactic. IE marks the readyState of the
	 * currently executing script to 'interactive'. If we can find this script
	 * while a define() is being called, we can match the define() to its name.
	 * Opera, why are you being so difficult!?!?!?!?
	 */


	var
		// local cache of resource definitions (lightweight promises)
		cache = {},
		// default configuration
		config = {
			doc: doc,
			baseUrl: null, // auto-detect
			pluginPath: 'curl/plugin/', // prepended to naked plugin references
			paths: {}
		},
		// net to catch anonymous define calls' arguments (non-IE browsers)
		argsNet,
		// current definition about to be loaded (this helps catch when
		// IE loads a script sync from cache)
		activeName,
		// this is the list of scripts that IE is loading. one of these will
		// be the "interactive" script. too bad IE doesn't send a readystatechange
		// event to tell us exactly which one.
		activeScripts = {},
		// this is always handy :)
		op = Object.prototype,
		toString = op.toString,
		// and this
		undef,
		aslice = [].slice,

		// RegExp's defined later
		pathRE,
		baseUrlRE,
		loadedRE,
		normalizeRE;

	var forin = (function(){
		// empty is to prevent for-in loop bug with shadowed properties
		// in IE
		var empty = {};
		function forin (obj, lambda) {
			// keys is to prevent Safari 2 double loop
			var keys = {}, p;
			for (p in obj) {
				if (!(p in op) && !(p in empty) && !(p in keys)) {
					keys[p] = 1;
					lambda(obj[p], p, obj);
				}
			}
		}
		return forin;
	})();

	function _isType (obj, type) {
		return toString.call(obj) === type;
	}
	function isFunction (obj) {
		return _isType(obj, '[object Function]');
	}

	function isString (obj) {
		return _isType(obj, '[object String]');
	}

	function isArray (obj) {
		return _isType(obj, '[object Array]');
	}

	//function isOpera (obj) {
	//	return _isType(obj, '[object Opera]');
	//}

	function findHead (doc) {
		// find and return the head element
		var el = doc.documentElement.firstChild;
		while (el && el.nodeType !== 1) el = el.nextSibling;
		return el;
	}<commit_msg>Improved forin.<commit_after>/**
 * curl (cujo resource loader)
 *
 * (c) copyright 2011, unscriptable.com
 * 
 */

// TODO: code documentation!!!
// TODO: packages
// TODO: commonjs exports and module dependencies
// TODO: finish debug plugin

var curl, require, define;
(function (global, doc) {

	/*
	 * Overall operation:
	 * When a dependency is encountered and it already exists, it's returned.
	 * If it doesn't already exist, it is created and the dependency's script
	 * is loaded. If there is a define call in the loaded script with a name,
	 * it is resolved asap (i.e. as soon as the dependency's dependencies are
	 * resolved). If there is a (single) define call with no name (anonymous),
	 * the resource in the resNet is resolved after the script's onload fires.
	 * IE requires a slightly different tactic. IE marks the readyState of the
	 * currently executing script to 'interactive'. If we can find this script
	 * while a define() is being called, we can match the define() to its name.
	 * Opera, why are you being so difficult!?!?!?!?
	 */


	var
		// local cache of resource definitions (lightweight promises)
		cache = {},
		// default configuration
		config = {
			doc: doc,
			baseUrl: null, // auto-detect
			pluginPath: 'curl/plugin/', // prepended to naked plugin references
			paths: {}
		},
		// net to catch anonymous define calls' arguments (non-IE browsers)
		argsNet,
		// current definition about to be loaded (this helps catch when
		// IE loads a script sync from cache)
		activeName,
		// this is the list of scripts that IE is loading. one of these will
		// be the "interactive" script. too bad IE doesn't send a readystatechange
		// event to tell us exactly which one.
		activeScripts = {},
		// this is always handy :)
		op = Object.prototype,
		toString = op.toString,
		// and this
		undef,
		aslice = [].slice,

		// RegExp's defined later
		pathRE,
		baseUrlRE,
		loadedRE,
		normalizeRE,

		// for...in bug detection
		propCount = (function(){
			var obj = { toString: 1 }, prop;
			for(prop in obj){ return 1; }
			return 0;
		})(),
		shadowed = [
			'constructor', 'hasOwnProperty',
			'isPrototypeOf', 'propertyIsEnumerable',
			'toLocaleString', 'toString', 'valueOf'
		],
		shadowedLen = shadowed.length,
		forin, oldforin;

	forin = function (obj, lambda) {
		// keys is to prevent Safari 2 double loop
		var keys = {}, p;
		for (p in obj) {
			if (!(p in op) && !(p in keys)) {
				keys[p] = 1;
				lambda(obj[p], p, obj);
			}
		}
	};
	if(!propCount){
		oldforin = forin;
		forin = function (obj, labmda) {
			var name, i = shadowedLen;
			oldforin.call(this, obj, lambda);
			// IE doesn't recognize some custom functions in for..in
			while(i--){
				name = shadowed[i];
				if(target.hasOwnProperty(name)){
					callback.call(thisArg, target[name], name, target);
				}
			}
		};
	}

	function _isType (obj, type) {
		return toString.call(obj) === type;
	}
	function isFunction (obj) {
		return _isType(obj, '[object Function]');
	}

	function isString (obj) {
		return _isType(obj, '[object String]');
	}

	function isArray (obj) {
		return _isType(obj, '[object Array]');
	}

	//function isOpera (obj) {
	//	return _isType(obj, '[object Opera]');
	//}

	function findHead (doc) {
		// find and return the head element
		var el = doc.documentElement.firstChild;
		while (el && el.nodeType !== 1) el = el.nextSibling;
		return el;
	}
{'fraction_non_alphanumeric': 0.12140575079872204, 'fraction_numerical': 0.002715654952076677, 'mean_word_length': 3.092156862745098, 'pattern_counts': {'":': 0, '<': 3, '<?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': '6663149', 'n_tokens_mistral': 2173, 'n_tokens_neox': 1919, 'n_words': 768}