was.js – Diff between revs 28 and 30
?pathlinks?
Rev 28 | Rev 30 | |||
---|---|---|---|---|
Line 1... | Line 1... | |||
1 | /*! was.js - v1.0.0 - 2017-12-13 |
1 | /*! was.js - v1.0.0 - 2017-12-13 |
|
2 | * http://grimore.org |
2 | * http://grimore.org |
|
3 | * Copyright (c) 2017 Wizardry and Steamworks <office@grimore.org>; Licensed GPL-3.0 */ |
3 | * Copyright (c) 2017 Wizardry and Steamworks <office@grimore.org>; Licensed GPL-3.0 */ |
|
Line 4... | Line -... | |||
4 | |
- | ||
5 | function wasProduct(t){for(var r=Math.max(this.length,this.length),e={},a=0;a<r;++a)e[this[a]]=t[a];return e}function wasStride(t){return this.filter(function(r,e){return e%t==0})}function wasChunk(t){return this.length?[this.slice(0,t)].concat(this.slice(t).wasChunk(t)):[]}function wasEquals(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}function wasCSVToArray(t){var r=[],e=[],a="";do{var o=t.charAt(0);if(t=t.slice(1,t.length),","!==o)if('"'!==o||t.charAt(0)!==o)if('"'!==o)a+=o;else{if(e[e.length-1]!==o){e.push(o);continue}e.pop()}else a+=o,t=t.slice(1,t.length);else{if('"'!==e[e.length-1]){r.push(a),a="";continue}a+=o}}while(""!==t);return r.push(a),r}function wasArrayToCSV(t){for(var r=[],e=0;e<t.length;++e){var a=t[e].toString().replace('"','""');/"\s,\r\n/.test(a)?r[e]='"'+a+'"':r[e]=a}return r.join()}function wasKeyValueToObject(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,a){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 a=!1,o=0;o |
4 | |
|
- | 5 | function wasProduct(r,t){for(var e=Math.max(r.length,t.length),n={},a=0;a<e;++a)n[r[a]]=t[a];return n}function wasStride(r,t){return r.filter(function(r,e){return e%t==0})}function wasChunk(r,t){return r.length?[r.slice(0,t)].concat(r.slice(t).wasChunk(t)):[]}function wasEquals(r,t){if(!t)return!1;if(r.length!==t.length)return!1;for(var e=0,n=r.length;e<n;e++)if(r[e]instanceof Array&&t[e]instanceof Array){if(!r[e].equals(t[e]))return!1}else if(r[e]!==t[e])return!1;return!0}function wasCSVToArray(r){var t=[],e=[],n="";do{var a=r.charAt(0);if(r=r.slice(1,r.length),","!==a)if('"'!==a||r.charAt(0)!==a)if('"'!==a)n+=a;else{if(e[e.length-1]!==a){e.push(a);continue}e.pop()}else n+=a,r=r.slice(1,r.length);else{if('"'!==e[e.length-1]){t.push(n),n="";continue}n+=a}}while(""!==r);return t.push(n),t}function wasArrayToCSV(r){for(var t=[],e=0;e<r.length;++e){var n=r[e].toString().replace('"','""');/"\s,\r\n/.test(n)?t[e]='"'+n+'"':t[e]=n}return t.join()}function wasKeyValueToObject(r){var t={};return r.reduce(function(r,t,e){return e=Math.floor(e/2),r[e]||(r[e]=[]),r[e].push(t),r},[]).forEach(function(r,e,n){t[r[0]]=r[1]},t),t}function wasSwitch(r,t,...e){if(e.length%2!=0)throw"Pairs of predicates expected for cases";(Array.isArray(r)?r:[r]).forEach(r=>{for(var n=!1,a=0;a |
||
6 | |
6 | |