forked from dshimkoski/jquery-inputs
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathaugment.min.js
executable file
·18 lines (18 loc) · 4.31 KB
/
augment.min.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// augment.js JavaScript 1.8.5 methods for all, version: 0.3.0
// using snippets from Mozilla - https://developer.mozilla.org/en/JavaScript
// (c) 2011 Oliver Nightingale
//
// Released under MIT license.
//
if(!Array.prototype.every)Array.prototype.every=function(d,c){if(this===void 0||this===null)throw new TypeError;var a=Object(this),b=a.length>>>0;if(typeof d!=="function")throw new TypeError;for(var e=0;e<b;e++)if(e in a&&!d.call(c,a[e],e,a))return!1;return!0};
if(!Array.prototype.filter)Array.prototype.filter=function(d,c){if(this===void 0||this===null)throw new TypeError;var a=Object(this),b=a.length>>>0;if(typeof d!=="function")throw new TypeError;for(var e=[],f=0;f<b;f++)if(f in a){var g=a[f];d.call(c,g,f,a)&&e.push(g)}return e};
if(!Array.prototype.forEach)Array.prototype.forEach=function(d,c){if(this===void 0||this===null)throw new TypeError;var a=Object(this),b=a.length>>>0;if(typeof d!=="function")throw new TypeError;for(var e=0;e<b;e++)e in a&&d.call(c,a[e],e,a)};
if(!Array.prototype.indexOf)Array.prototype.indexOf=function(d){if(this===void 0||this===null)throw new TypeError;var c=Object(this),a=c.length>>>0;if(a===0)return-1;var b=0;arguments.length>0&&(b=Number(arguments[1]),b!==b?b=0:b!==0&&b!==Infinity&&b!==-Infinity&&(b=(b>0||-1)*Math.floor(Math.abs(b))));if(b>=a)return-1;for(b=b>=0?b:Math.max(a-Math.abs(b),0);b<a;b++)if(b in c&&c[b]===d)return b;return-1};Array.isArray=Array.isArray||function(d){return Object.prototype.toString.call(d)==="[object Array]"};
if(!Array.prototype.lastIndexOf)Array.prototype.lastIndexOf=function(d){if(this===void 0||this===null)throw new TypeError;var c=Object(this),a=c.length>>>0;if(a===0)return-1;var b=a;arguments.length>1&&(b=Number(arguments[1]),b!==b?b=0:b!==0&&b!==Infinity&&b!==-Infinity&&(b=(b>0||-1)*Math.floor(Math.abs(b))));for(a=b>=0?Math.min(b,a-1):a-Math.abs(b);a>=0;a--)if(a in c&&c[a]===d)return a;return-1};
if(!Array.prototype.map)Array.prototype.map=function(d,c){if(this===void 0||this===null)throw new TypeError;var a=Object(this),b=a.length>>>0;if(typeof d!=="function")throw new TypeError;for(var e=Array(b),f=0;f<b;f++)f in a&&(e[f]=d.call(c,a[f],f,a));return e};
if(!Array.prototype.reduce)Array.prototype.reduce=function(d){if(this===void 0||this===null)throw new TypeError;var c=Object(this),a=c.length>>>0;if(typeof d!=="function")throw new TypeError;if(a==0&&arguments.length==1)throw new TypeError;var b=0,e;if(arguments.length>=2)e=arguments[1];else{do{if(b in c){e=c[b++];break}if(++b>=a)throw new TypeError;}while(1)}for(;b<a;)b in c&&(e=d.call(void 0,e,c[b],b,c)),b++;return e};
if(!Array.prototype.reduceRight)Array.prototype.reduceRight=function(d){if(this===void 0||this===null)throw new TypeError;var c=Object(this),a=c.length>>>0;if(typeof d!=="function")throw new TypeError;if(a===0&&arguments.length===1)throw new TypeError;a-=1;var b;if(arguments.length>=2)b=arguments[1];else{do{if(a in this){b=this[a--];break}if(--a<0)throw new TypeError;}while(1)}for(;a>=0;)a in c&&(b=d.call(void 0,b,c[a],a,c)),a--;return b};
if(!Array.prototype.some)Array.prototype.some=function(d,c){if(this===void 0||this===null)throw new TypeError;var a=Object(this),b=a.length>>>0;if(typeof d!=="function")throw new TypeError;for(var e=0;e<b;e++)if(e in a&&d.call(c,a[e],e,a))return!0;return!1};if(!Date.now)Date.now=function(){return+new Date};if(!Date.prototype.toJSON)Date.prototype.toJSON=Date.prototype.toJSON;
if(!Date.prototype.toISOString)Date.prototype.toISOString=function(){var d=function(c,a){a=a||2;return(c+="",c.length===a)?c:d("0"+c,a)};return function(){var c=[this.getUTCFullYear(),d(this.getUTCMonth()+1),d(this.getUTCDate())].join("-"),a=[d(this.getUTCHours()),d(this.getUTCMinutes()),d(this.getUTCSeconds())].join(":")+"."+d(this.getUTCMilliseconds(),3);return[c,a].join("T")+"Z"}}();
if(!Function.prototype.bind)Function.prototype.bind=function(d){var c=[].slice,a=c.call(arguments,1),b=this,e=function(){},f=function(){return b.apply(this instanceof e?this:d||{},a.concat(c.call(arguments)))};e.prototype=b.prototype;f.prototype=new e;return f};if(!Object.keys)Object.keys=function(d){if(d!==Object(d))throw new TypeError("Object.keys called on non-object");var c=[],a;for(a in d)Object.prototype.hasOwnProperty.call(d,a)&&c.push(a);return c};
if(!String.prototype.trim)String.prototype.trim=function(){var d=/^\s+/,c=/\s+$/;return function(){return this.replace(d,"").replace(c,"")}}();