<commit_before>/*
 * gesso.js - A simple wrapper for html canvas streamlining.
 * (c) 2012 <NAME>
 * http://github.com/rmunson/gesso
 */ 

(function (root, factory) {
    if (typeof define === 'function' && define.amd) {
        // AMD. Register as an anonymous module.
        define(function () {
            return factory();
        });
    } else{
    	root.gesso=factory();
    }
})(this,function(){
	'use strict'
	var meth,
		can=window.document && document.createElement('canvas'),
		og=can && can.getContext && can.getContext('2d')||{},
		proto={},

	cap = function(str){
		return str.charAt(0).toUpperCase() + str.substr(1);
	},
	ensureArray = function (obj){
		return obj = obj && (Array.isArray(obj) ? obj : [obj]) || [];
    },

    	/* used in constructing api (free to clear) */
	wrap=function(_meth){
		return typeof og[_meth]==="function" ? function(){
				//Return value if available, or chain.
			return this._ctx_[_meth] && this._ctx_[_meth].apply(this._ctx_,arguments) || this;
		} : function(val){
			this._ctx_[_meth]=val;
			return this;
		};
	},
		/* used in constructing api (free to clear) */
	grouper = function(item){
		var og=proto[item],
			run=function(props){
				for(var key in props){
					this[item+cap(key)] && this[item+cap(key)].apply(this,ensureArray(props[key]));
				}
			return this
		};
		return og ? function(props){
			return !props ? og.call(this) : run.call(this,props);
		} : run
	},
		
	gesso = function(can){
		this._ctx_=can && can.getContext && can.getContext('2d')||{};
	};

	for(meth in og){
		proto[meth]=wrap(meth);
	}

	'shadow,line,text,fill,stroke'.split(',').forEach(function(group){
		proto[group]=grouper(group);
	});
	gesso.prototype=proto;

	/* clear out garbage */
	can=og=wrap=grouper=meth=null;

 	/**
 	 * Expose gesso for CommonJS, AMD, or non-require environments.
 	 * Use available define method or attach to exports if present. Otherwise
 	 * assign to window.gesso.
 	 * @param  {function} g Closure function to handle setup.
 	 */
 	return function(can){
		return new gesso(can);
	};
});<commit_msg>umd and getters for the origina canvas and context<commit_after>/*
 * gesso.js - "Canvas and canvas context wrapper.  Supplies a chainable api of canvas methods, and command grouping."
 * (c) 2012 <NAME>
 * http://github.com/rmunson/gesso
 */ 

(function (root, factory) {
    if (typeof define === 'function' && define.amd) {
        // AMD. Register as an anonymous module.
        define(function () {
            return factory();
        });
    } else{
    	root.gesso=factory();
    }
})(this,function(){
	'use strict'
	var meth,
		can=window.document && document.createElement('canvas'),
		og=can && can.getContext && can.getContext('2d')||{},
		proto={},

	cap = function(str){
		return str.charAt(0).toUpperCase() + str.substr(1);
	},
	ensureArray = function (obj){
		return obj = obj && (Array.isArray(obj) ? obj : [obj]) || [];
    },

    	/* used in constructing api (free to clear) */
	wrap=function(_meth){
		return typeof og[_meth]==="function" ? function(){
				//Return value if available, or chain.
			return this._ctx_[_meth] && this._ctx_[_meth].apply(this._ctx_,arguments) || this;
		} : function(val){
			this._ctx_[_meth]=val;
			return this;
		};
	},
		/* used in constructing api (free to clear) */
	grouper = function(item){
		var og=proto[item],
			run=function(props){
				for(var key in props){
					this[item+cap(key)] && this[item+cap(key)].apply(this,ensureArray(props[key]));
				}
			return this
		};
		return og ? function(props){
			return !props ? og.call(this) : run.call(this,props);
		} : run
	};
		
	for(meth in og){
		proto[meth]=wrap(meth);
	}

	'shadow,line,text,fill,stroke'.split(',').forEach(function(group){
		proto[group]=grouper(group);
	});

	proto.getContext = function(){
		return this._ctx_;
	};
	proto.getCanvas = function(){
		return this._ctx_.canvas;
	};

	function gesso( can ){
		if(!(this instanceof gesso)){
			return new gesso(can);
		}
		this._ctx_=can && can.getContext && can.getContext('2d')||{};
	};


	gesso.prototype=proto;

	/* clear out garbage */
	can=og=wrap=grouper=meth=null;

 	/**
 	 * Expose gesso for CommonJS, AMD, or non-require environments.
 	 * Use available define method or attach to exports if present. Otherwise
 	 * assign to window.gesso.
 	 * @param  {function} g Closure function to handle setup.
 	 */
 	return gesso;
});
{'fraction_non_alphanumeric': 0.17144808743169399, 'fraction_numerical': 0.0036429872495446266, 'mean_word_length': 3.441860465116279, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '578192', 'n_tokens_mistral': 1614, 'n_tokens_neox': 1462, 'n_words': 352}