was.js – Blame information for rev 24

Subversion Repositories:
Rev:
Rev Author Line No. Line
24 office 1 /*! was.js - v1.0.0 - 2017-12-13
3 office 2 * http://grimore.org
3 * Copyright (c) 2017 Wizardry and Steamworks <office@grimore.org>; Licensed GPL-3.0 */
24 office 4  
5 function wasCSVToArray(t){var r=[],e=[],n="";do{var i=t.charAt(0);if(t=t.slice(1,t.length),","!==i)if('"'!==i||t.charAt(0)!==i)if('"'!==i)n+=i;else{if(e[e.length-1]!==i){e.push(i);continue}e.pop()}else n+=i,t=t.slice(1,t.length);else{if('"'!==e[e.length-1]){r.push(n),n="";continue}n+=i}}while(""!==t);return r.push(n),r}function wasArrayToCSV(t){for(var r=[],e=0;e<t.length;++e){var n=t[e].toString().replace('"','""');/"\s,\r\n/.test(n)?r[e]='"'+n+'"':r[e]=n}return r.join()}function wasKeyValueObjectify(t){var r={};return t.reduce(function(t,r,e){return e=Math.floor(e/2),t[e]||(t[e]=[]),t[e].push(r),t},[]).forEach(function(t,e,n){r[t[0]]=t[1]},r),r}function wasSwitch(t,r,...e){if(e.length%2!=0)throw"Pairs of predicates expected for cases";(Array.isArray(this)?this:[this]).forEach(t=>{for(var n=!1,i=0;i(e-r)}function wasHexToRGB(t){t=t.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,function(t,r,e,n){return r+r+e+e+n+n});var r=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);return r?{r:parseInt(r[1],16),g:parseInt(r[2],16),b:parseInt(r[3],16)}:null}function wasRGBToHex(t,r,e){return"#"+((1<<24)+(t<<16)+(r<<8)+e).toString(16).slice(1)}Array.prototype.product||(Array.prototype.product=function(t){var r=this;return $.map(new Array(Math.max(this.length,r.length)),function(e,n){var i={};return i[r[n]]=t[n],i})}),$.extend({product:function(t,r){return $.map(new Array(Math.max(this.length,t.length)),function(e,n){var i={};return i[t[n]]=r[n],i})}}),Array.prototype.stride||(Array.prototype.stride=function(t){return this.filter(function(r,e){return e%t==0})}),$.extend({stride:function(t,r){return t.filter(function(t,e){return e%r==0})}}),Array.prototype.chunk||(Array.prototype.chunk=function(t){return this.length?[this.slice(0,t)].concat(this.slice(t).chunk(t)):[]}),$.extend({chunk:function(t,r){return t.length?[t.slice(0,r)].concat(t.slice(r).chunk(r)):[]}}),Array.prototype.equals||(Array.prototype.equals=function(t){if(!t)return!1;if(this.length!==t.length)return!1;for(var r=0,e=this.length;r<e;r++)if(this[r]instanceof Array&&t[r]instanceof Array){if(!this[r].equals(t[r]))return!1}else if(this[r]!==t[r])return!1;return!0}),$.extend({equals:function(t){if(!t)return!1;if(this.length!==t.length)return!1;for(var r=0,e=this.length;r<e;r++)if(this[r]instanceof Array&&t[r]instanceof Array){if(!this[r].equals(t[r]))return!1}else if(this[r]!==t[r])return!1;return!0}}),Array.prototype.switch||(Array.prototype.switch=wasSwitch),"function"==typeof jQuery&&$.extend({switch:wasSwitch}),module.exports={switch:wasSwitch};