{"size": 4716, "ext": "js", "max_stars_repo_path": "dist/modules/utils/utils.min.js", "max_stars_repo_name": "hufyhang/chop", "max_stars_repo_stars_event_min_datetime": "2015-02-25T16:21:27.000Z", "max_stars_repo_stars_event_max_datetime": "2015-03-02T09:03:34.000Z", "max_issues_repo_path": "dist/modules/utils/utils.min.js", "max_issues_repo_name": "hufyhang/chop", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "dist/modules/utils/utils.min.js", "max_forks_repo_name": "hufyhang/chop", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 2, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 4716.0, "max_line_length": 4716, "alphanum_fraction": 0.6942324003}
$ch.define("utils",function(){"use strict";$$CHOP.utils={},$$CHOP.utils={changes:function(a,b){var c,d,e={};for(c in b)a&&a[c]===b[c]||("object"==typeof a[c]?(d=this.changes(a[c],b[c]),d&&(e[c]=d)):e[c]=b[c]);for(c in e)if(e.hasOwnProperty(c))return e;return!1},sort:function(a,b,c){if(0===arguments.length)throw new Error("$ch.utils.sort requires at least one parameter.");if("boolean"==typeof b)c=b,b=void 0;else if("string"!=typeof b&&void 0!==b)throw new Error("$ch.utils.sort requires a string type parameter for sort-by.");if(void 0===c&&(c=!1),!$$CHOP._isArray(a))throw new Error("$ch.utils.sort can only sort array-type objects.");var d=a;return 0!==a.length&&(d="number"==typeof a[0]?d.sort(function(a,b){return a-b}):"object"==typeof a[0]?d.sort(function(a,c){return a[b]<c[b]?!1:!0}):d.sort(),c===!0&&d.reverse()),d},extend:function(a,b){if(2!==arguments.length)throw new Error("$ch.utils.extend requires two parameters");for(var c in b)b[c]&&b[c].constructor&&b[c].constructor===Object?(a[c]=a[c]||{},this.extend(a[c],b[c])):a[c]=b[c];return a},bind:function(a,b){var c=a;return c.bind(b)},first:function(a,b){if($$CHOP.isArray(a)===!1)throw new Error("$ch.utils.first requires an array-type parameter.");"number"!=typeof b&&(b=a.length);for(var c=[],d=0;b>d;++d)c.push(a[d]);return c},last:function(a,b){if($$CHOP.isArray(a)===!1)throw new Error("$ch.utils.last requires an array-type parameter.");"number"!=typeof b&&(b=0);for(var c=[],d=a.length-b,e=a.length;e>d;++d)c.push(a[d]);return c},map:function(a,b){if($$CHOP.isArray(a)===!1)throw new Error("$ch.utils.map requires an array-type parameter.");if("function"!=typeof b)throw new Error("$ch.utils.map requires a function-type callback parameter.");var c=[];return $$CHOP.each(a,function(a){var d=b(a);c.push(d)}),c},now:function(){return Date.parse(Date())},fromNow:function(a){var b=Math.floor((new Date-a)/1e3),c=Math.floor(b/31536e3);return c>1?c+" years":(c=Math.floor(b/2592e3),c>1?c+" months":(c=Math.floor(b/86400),c>1?c+" days":(c=Math.floor(b/3600),c>1?c+" hours":(c=Math.floor(b/60),c>1?c+" minutes":Math.floor(b)+" seconds"))))},random:function(a,b){if(2!==arguments.length)throw new Error("$ch.utils.random requires two parameters.");var c="string"==typeof a||"number"==typeof a,d="string"==typeof b||"number"==typeof b;if(c===!1||d===!1)throw new Error("$ch.utils.random only takes either numbers or strings as parameters.");return"string"==typeof a&&(a=parseInt(a,10)),"string"==typeof b&&(b=parseInt(b,10)),Math.floor(Math.random()*b)+a},urlParams:function(a){for(var b={},c=window.location.search.substring(1),d=c.split("&"),e=0;e<d.length;e++){var f=d[e].split("=");if(0===arguments.length)b[f[0]]=f[1];else if(f[0]===a)return f[1]}return b},isString:function(a){if(1!==arguments.length)throw new Error("$ch.utils.isString requires one parameter.");return"string"==typeof a},isBoolean:function(a){if(1!==arguments.length)throw new Error("$ch.utils.isBoolean requires one parameter.");return"boolean"==typeof a},isNumber:function(a){if(1!==arguments.length)throw new Error("$ch.utils.isNumber requires one parameter.");return"number"==typeof a},isUndefined:function(a){if(1!==arguments.length)throw new Error("$ch.utils.isUndefined requires one parameter.");return void 0===a},isNull:function(a){if(1!==arguments.length)throw new Error("$ch.utils.isNull requires one parameter.");return null===a},isNaN:function(a){if(1!==arguments.length)throw new Error("$ch.utils.isNaN requires one parameter.");return"string"==typeof a&&(a=parseFloat(a)),Number.isNaN(a)},isArray:function(a){if(1!==arguments.length)throw new Error("$ch.utils.isArray requires one parameter.");return $$CHOP.isArray(a)},isObject:function(a){if(1!==arguments.length)throw new Error("$ch.utils.isObject requires one parameter.");var b=!1;return"object"==typeof a&&this.isArray(a)===!1&&(b=!0),b},isFunction:function(a){if(1!==arguments.length)throw new Error("$ch.utils.isFunction requires one parameter.");return"function"==typeof a},isEmpty:function(a){if(1!==arguments.length)throw new Error("$ch.utils.isEmpty requires one parameter.");return this.isArray(a)===!0?0===a.length:this.isObject(a)===!0?0===Object.keys(a).length:void 0},isEqual:function(a,b){if(2!==arguments.length)throw new Error("$ch.utils.isEqual requires two parameters.");var c,d;if(typeof a!=typeof b)return!1;if(this.isNumber(a)||this.isString(a)||this.isBoolean(a))return a===b;if(this.isArray(a)){if(a.length!==b.length)return!1;for(c=0,d=a.length;c!==d;++c)if(a[c]!==b[c])return!1}if(this.isObject(a)){var e=Object.keys(a),f=Object.keys(b);if(e.length!==f.length)return!1;var g;for(c=0,d=e.length;c!==d;++c){if(g=e[c],a[g]!==b[g])return!1;if(g=f[c],a[g]!==b[g])return!1}}return!0}}});