was.js – Diff between revs 54 and 57

Subversion Repositories:
Rev:
Only display areas with differencesIgnore whitespace
Rev 54 Rev 57
1 /*! was.js - v1.0.8 - 2020-12-09 1 /*! was.js - v1.0.8 - 2021-10-31
2 * http://grimore.org 2 * http://grimore.org
3 * Copyright (c) 2020 [object Object]; Licensed GPL-3.0 */ 3 * Copyright (c) 2021 [object Object]; Licensed GPL-3.0 */
4 /* Copyright (C) 2017 Wizardry and Steamworks - License: GNU GPLv3 */ 4 /* Copyright (C) 2017 Wizardry and Steamworks - License: GNU GPLv3 */
5 /*************************************************************************/ 5 /*************************************************************************/
6 function wasArrayToObject(a) { 6 function wasArrayToObject(a) {
7 var o = {}; 7 var o = {};
8 a.reduce(function(a, c, i) { 8 a.reduce(function(a, c, i) {
9 i = Math.floor(i / 2); 9 i = Math.floor(i / 2);
10 if (!a[i]) { 10 if (!a[i]) {
11 a[i] = []; 11 a[i] = [];
12 } 12 }
13 a[i].push(c); 13 a[i].push(c);
14 return a; 14 return a;
15 }, []).forEach(function(c, i, a) { 15 }, []).forEach(function(c, i, a) {
16 o[c[0]] = c[1]; 16 o[c[0]] = c[1];
17 }, o); 17 }, o);
18 return o; 18 return o;
19 } 19 }
20 if (!Array.prototype.toObject) { 20 if (!Array.prototype.toObject) {
21 Array.prototype.toObject = function() { 21 Array.prototype.toObject = function() {
22 return wasArrayToObject(this); 22 return wasArrayToObject(this);
23 }; 23 };
24 } 24 }
25 // jQuery 25 // jQuery
26 if(typeof jQuery === 'function') { 26 if(typeof jQuery === 'function') {
27 $.extend({ 27 $.extend({
28 toObject: wasArrayToObject 28 toObject: wasArrayToObject
29 }); 29 });
30 } 30 }
31   31  
32   32  
33 /*************************************************************************/ 33 /*************************************************************************/
34 /* Copyright (C) 2017 Wizardry and Steamworks - License: GNU GPLv3 */ 34 /* Copyright (C) 2017 Wizardry and Steamworks - License: GNU GPLv3 */
35 /*************************************************************************/ 35 /*************************************************************************/
36 function wasProduct(a, b) { 36 function wasProduct(a, b) {
37 var m = Math.max(a.length, b.length); 37 var m = Math.max(a.length, b.length);
38 var o = {}; 38 var o = {};
39 for(var i = 0; i < m; ++i) { 39 for(var i = 0; i < m; ++i) {
40 < m; ++i) { o[a[i]] = b[i]; 40 < m; ++i) { o[a[i]] = b[i];
41 < m; ++i) { } 41 < m; ++i) { }
42 < m; ++i) { return o; 42 < m; ++i) { return o;
43 < m; ++i) {} 43 < m; ++i) {}
44 < m; ++i) {if (!Array.prototype.product) { 44 < m; ++i) {if (!Array.prototype.product) {
45 < m; ++i) { Array.prototype.product = function(b) { 45 < m; ++i) { Array.prototype.product = function(b) {
46 < m; ++i) { return wasProduct(this, b); 46 < m; ++i) { return wasProduct(this, b);
47 < m; ++i) { }; 47 < m; ++i) { };
48 < m; ++i) {} 48 < m; ++i) {}
49 < m; ++i) {// jQuery 49 < m; ++i) {// jQuery
50 < m; ++i) {if(typeof jQuery === 'function') { 50 < m; ++i) {if(typeof jQuery === 'function') {
51 < m; ++i) { $.extend({ 51 < m; ++i) { $.extend({
52 < m; ++i) { product: wasProduct 52 < m; ++i) { product: wasProduct
53 < m; ++i) { }); 53 < m; ++i) { });
54 < m; ++i) {} 54 < m; ++i) {}
55 < m; ++i) { 55 < m; ++i) {
56 < m; ++i) {/*************************************************************************/ 56 < m; ++i) {/*************************************************************************/
57 < m; ++i) {/* Copyright (C) 2017 Wizardry and Steamworks - License: GNU GPLv3 */ 57 < m; ++i) {/* Copyright (C) 2017 Wizardry and Steamworks - License: GNU GPLv3 */
58 < m; ++i) {/*************************************************************************/ 58 < m; ++i) {/*************************************************************************/
59 < m; ++i) {function wasStride(a, s) { 59 < m; ++i) {function wasStride(a, s) {
60 < m; ++i) { return a.filter(function(e, i) { 60 < m; ++i) { return a.filter(function(e, i) {
61 < m; ++i) { return i % s === 0; 61 < m; ++i) { return i % s === 0;
62 < m; ++i) { }); 62 < m; ++i) { });
63 < m; ++i) {} 63 < m; ++i) {}
64 < m; ++i) {if (!Array.prototype.stride) { 64 < m; ++i) {if (!Array.prototype.stride) {
65 < m; ++i) { Array.prototype.stride = function(s) { 65 < m; ++i) { Array.prototype.stride = function(s) {
66 < m; ++i) { return wasStride(this, s); 66 < m; ++i) { return wasStride(this, s);
67 < m; ++i) { }; 67 < m; ++i) { };
68 < m; ++i) {} 68 < m; ++i) {}
69 < m; ++i) {// jQuery 69 < m; ++i) {// jQuery
70 < m; ++i) {if(typeof jQuery === 'function') { 70 < m; ++i) {if(typeof jQuery === 'function') {
71 < m; ++i) { $.extend({ 71 < m; ++i) { $.extend({
72 < m; ++i) { stride: wasStride 72 < m; ++i) { stride: wasStride
73 < m; ++i) { }); 73 < m; ++i) { });
74 < m; ++i) {} 74 < m; ++i) {}
75 < m; ++i) { 75 < m; ++i) {
76 < m; ++i) {// Vanilla JavaScript 76 < m; ++i) {// Vanilla JavaScript
77 < m; ++i) {function wasChunk(a, n) { 77 < m; ++i) {function wasChunk(a, n) {
78 < m; ++i) { return Array.from(new Array(Math.ceil(a.length/n)), (_,i)=>a.slice(i*n,i*n+n)); 78 < m; ++i) { return Array.from(new Array(Math.ceil(a.length/n)), (_,i)=>a.slice(i*n,i*n+n));
79 < m; ++i) {} 79 < m; ++i) {}
80 < m; ++i) {if (!Array.prototype.chunk) { 80 < m; ++i) {if (!Array.prototype.chunk) {
81 < m; ++i) { Array.prototype.chunk = function(a, n) { 81 < m; ++i) { Array.prototype.chunk = function(a, n) {
82 < m; ++i) { return wasChunk(this, n); 82 < m; ++i) { return wasChunk(this, n);
83 < m; ++i) { }; 83 < m; ++i) { };
84 < m; ++i) {} 84 < m; ++i) {}
85 < m; ++i) {// jQuery 85 < m; ++i) {// jQuery
86 < m; ++i) {if(typeof jQuery === 'function') { 86 < m; ++i) {if(typeof jQuery === 'function') {
87 < m; ++i) { $.extend({ 87 < m; ++i) { $.extend({
88 < m; ++i) { chunk: wasChunk 88 < m; ++i) { chunk: wasChunk
89 < m; ++i) { }); 89 < m; ++i) { });
90 < m; ++i) {} 90 < m; ++i) {}
91 < m; ++i) { 91 < m; ++i) {
92 < m; ++i) {/*************************************************************************/ 92 < m; ++i) {/*************************************************************************/
93 < m; ++i) {/* Copyright (C) 2017 Wizardry and Steamworks - License: GNU GPLv3 */ 93 < m; ++i) {/* Copyright (C) 2017 Wizardry and Steamworks - License: GNU GPLv3 */
94 < m; ++i) {/*************************************************************************/ 94 < m; ++i) {/*************************************************************************/
95 < m; ++i) {/*stackoverflow.com/questions/7837456/how-to-compare-arrays-in-javascript*/ 95 < m; ++i) {/*stackoverflow.com/questions/7837456/how-to-compare-arrays-in-javascript*/
96 < m; ++i) {/*************************************************************************/ 96 < m; ++i) {/*************************************************************************/
97 < m; ++i) {// Vanilla JavaScript 97 < m; ++i) {// Vanilla JavaScript
98 < m; ++i) {function wasEquals(a, b) { 98 < m; ++i) {function wasEquals(a, b) {
99 < m; ++i) { // if the other array is a falsy value, return 99 < m; ++i) { // if the other array is a falsy value, return
100 < m; ++i) { if (!b) { 100 < m; ++i) { if (!b) {
101 < m; ++i) { return false; 101 < m; ++i) { return false;
102 < m; ++i) { } 102 < m; ++i) { }
103 < m; ++i) { 103 < m; ++i) {
104 < m; ++i) { // compare lengths - can save a lot of time 104 < m; ++i) { // compare lengths - can save a lot of time
105 < m; ++i) { if (a.length !== b.length) { 105 < m; ++i) { if (a.length !== b.length) {
106 < m; ++i) { return false; 106 < m; ++i) { return false;
107 < m; ++i) { } 107 < m; ++i) { }
108 < m; ++i) { 108 < m; ++i) {
109 < m; ++i) { for (var i = 0, l = a.length; i < l; i++) { 109 < m; ++i) { for (var i = 0, l = a.length; i < l; i++) {
110 < m; ++i) { // Check if we have nested arrays 110 < m; ++i) { // Check if we have nested arrays
111 < m; ++i) { if (a[i] instanceof Array && b[i] instanceof Array) { 111 < m; ++i) { if (a[i] instanceof Array && b[i] instanceof Array) {
112 < m; ++i) { // recurse into the nested arrays 112 < m; ++i) { // recurse into the nested arrays
113 < m; ++i) { if (!a[i].equals(b[i])) { 113 < m; ++i) { if (!a[i].equals(b[i])) {
114 < m; ++i) { return false; 114 < m; ++i) { return false;
115 < m; ++i) { } 115 < m; ++i) { }
116 < m; ++i) { } else if (a[i] !== b[i]) { 116 < m; ++i) { } else if (a[i] !== b[i]) {
117 < m; ++i) { // Warning - two different object instances will never be equal: {x:20} != {x:20} 117 < m; ++i) { // Warning - two different object instances will never be equal: {x:20} != {x:20}
118 < m; ++i) { return false; 118 < m; ++i) { return false;
119 < m; ++i) { } 119 < m; ++i) { }
120 < m; ++i) { } 120 < m; ++i) { }
121 < m; ++i) { return true; 121 < m; ++i) { return true;
122 < m; ++i) {} 122 < m; ++i) {}
123 < m; ++i) {if (!Array.prototype.equals) { 123 < m; ++i) {if (!Array.prototype.equals) {
124 < m; ++i) { // attach the .equals method to Array's prototype to call it on any array 124 < m; ++i) { // attach the .equals method to Array's prototype to call it on any array
125 < m; ++i) { Array.prototype.equals = function(a, b) { 125 < m; ++i) { Array.prototype.equals = function(a, b) {
126 < m; ++i) { return wasEquals(this, b); 126 < m; ++i) { return wasEquals(this, b);
127 < m; ++i) { }; 127 < m; ++i) { };
128 < m; ++i) {} 128 < m; ++i) {}
129 < m; ++i) {// jQuery 129 < m; ++i) {// jQuery
130 < m; ++i) {if(typeof jQuery === 'function') { 130 < m; ++i) {if(typeof jQuery === 'function') {
131 < m; ++i) { $.extend({ 131 < m; ++i) { $.extend({
132 < m; ++i) { equals: wasEquals 132 < m; ++i) { equals: wasEquals
133 < m; ++i) { }); 133 < m; ++i) { });
134 < m; ++i) {} 134 < m; ++i) {}
135 < m; ++i) { 135 < m; ++i) {
136 < m; ++i) {/*************************************************************************/ 136 < m; ++i) {/*************************************************************************/
137 < m; ++i) {/* Node.JS package export. */ 137 < m; ++i) {/* Node.JS package export. */
138 < m; ++i) {/*************************************************************************/ 138 < m; ++i) {/*************************************************************************/
139 < m; ++i) {if(typeof module !== 'undefined' && typeof module.exports !== 'undefined') { 139 < m; ++i) {if(typeof module !== 'undefined' && typeof module.exports !== 'undefined') {
140 < m; ++i) { module.exports.collections = { 140 < m; ++i) { module.exports.collections = {
141 < m; ++i) { product: wasProduct, 141 < m; ++i) { product: wasProduct,
142 < m; ++i) { stride: wasStride, 142 < m; ++i) { stride: wasStride,
143 < m; ++i) { chunk: wasChunk, 143 < m; ++i) { chunk: wasChunk,
144 < m; ++i) { equals: wasEquals, 144 < m; ++i) { equals: wasEquals,
145 < m; ++i) { toObject: wasArrayToObject 145 < m; ++i) { toObject: wasArrayToObject
146 < m; ++i) { }; 146 < m; ++i) { };
147 < m; ++i) {} 147 < m; ++i) {}
148 < m; ++i) { 148 < m; ++i) {
149 < m; ++i) {/* Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 */ 149 < m; ++i) {/* Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 */
150 < m; ++i) {/*************************************************************************/ 150 < m; ++i) {/*************************************************************************/
151 < m; ++i) {function wasCSVToArray(csv) { 151 < m; ++i) {function wasCSVToArray(csv) {
152 < m; ++i) { var l = []; 152 < m; ++i) { var l = [];
153 < m; ++i) { var s = []; 153 < m; ++i) { var s = [];
154 < m; ++i) { var m = ""; 154 < m; ++i) { var m = "";
155 < m; ++i) { 155 < m; ++i) {
156 < m; ++i) { do { 156 < m; ++i) { do {
157 < m; ++i) { var a = csv.charAt(0); 157 < m; ++i) { var a = csv.charAt(0);
158 < m; ++i) { csv = csv.slice(1, csv.length); 158 < m; ++i) { csv = csv.slice(1, csv.length);
159 < m; ++i) { if(a === ",") { 159 < m; ++i) { if(a === ",") {
160 < m; ++i) { if(s[s.length-1] !== '"') { 160 < m; ++i) { if(s[s.length-1] !== '"') {
161 < m; ++i) { l.push(m); 161 < m; ++i) { l.push(m);
162 < m; ++i) { m = ""; 162 < m; ++i) { m = "";
163 < m; ++i) { continue; 163 < m; ++i) { continue;
164 < m; ++i) { } 164 < m; ++i) { }
165 < m; ++i) { m += a; 165 < m; ++i) { m += a;
166 < m; ++i) { continue; 166 < m; ++i) { continue;
167 < m; ++i) { } 167 < m; ++i) { }
168 < m; ++i) { if(a === '"' && csv.charAt(0) === a) { 168 < m; ++i) { if(a === '"' && csv.charAt(0) === a) {
169 < m; ++i) { m += a; 169 < m; ++i) { m += a;
170 < m; ++i) { csv = csv.slice(1, csv.length); 170 < m; ++i) { csv = csv.slice(1, csv.length);
171 < m; ++i) { continue; 171 < m; ++i) { continue;
172 < m; ++i) { } 172 < m; ++i) { }
173 < m; ++i) { if(a === '"') { 173 < m; ++i) { if(a === '"') {
174 < m; ++i) { if(s[s.length-1] !== a) { 174 < m; ++i) { if(s[s.length-1] !== a) {
175 < m; ++i) { s.push(a); 175 < m; ++i) { s.push(a);
176 < m; ++i) { continue; 176 < m; ++i) { continue;
177 < m; ++i) { } 177 < m; ++i) { }
178 < m; ++i) { s.pop(); 178 < m; ++i) { s.pop();
179 < m; ++i) { continue; 179 < m; ++i) { continue;
180 < m; ++i) { } 180 < m; ++i) { }
181 < m; ++i) { m += a; 181 < m; ++i) { m += a;
182 < m; ++i) { } while(csv !== ""); 182 < m; ++i) { } while(csv !== "");
183 < m; ++i) { 183 < m; ++i) {
184 < m; ++i) { l.push(m); 184 < m; ++i) { l.push(m);
185 < m; ++i) { 185 < m; ++i) {
186 < m; ++i) { return l; 186 < m; ++i) { return l;
187 < m; ++i) {} 187 < m; ++i) {}
188 < m; ++i) { 188 < m; ++i) {
189 < m; ++i) {/*************************************************************************/ 189 < m; ++i) {/*************************************************************************/
190 < m; ++i) {/* Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 */ 190 < m; ++i) {/* Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 */
191 < m; ++i) {/*************************************************************************/ 191 < m; ++i) {/*************************************************************************/
192 < m; ++i) {function wasArrayToCSV(a) { 192 < m; ++i) {function wasArrayToCSV(a) {
193 < m; ++i) { var csv = []; 193 < m; ++i) { var csv = [];
194 < m; ++i) { for(var i=0; i<a.length; ++i) { 194 < m; ++i) { for(var i=0; i<a.length; ++i) {
195 < m; ++i) { var cell = a[i].toString().replace('"', '""'); 195 < m; ++i) { var cell = a[i].toString().replace('"', '""');
196 < m; ++i) { if(/"\s,\r\n/.test(cell)) { 196 < m; ++i) { if(/"\s,\r\n/.test(cell)) {
197 < m; ++i) { csv[i] = '"' + cell + '"'; 197 < m; ++i) { csv[i] = '"' + cell + '"';
198 < m; ++i) { continue; 198 < m; ++i) { continue;
199 < m; ++i) { } 199 < m; ++i) { }
200 < m; ++i) { csv[i] = cell; 200 < m; ++i) { csv[i] = cell;
201 < m; ++i) { } 201 < m; ++i) { }
202 < m; ++i) { return csv.join(); 202 < m; ++i) { return csv.join();
203 < m; ++i) {} 203 < m; ++i) {}
204 < m; ++i) { 204 < m; ++i) {
205 < m; ++i) {/* Node.JS package export. */ 205 < m; ++i) {/* Node.JS package export. */
206 < m; ++i) {/*************************************************************************/ 206 < m; ++i) {/*************************************************************************/
207 < m; ++i) {if(typeof module !== 'undefined' && typeof module.exports !== 'undefined') { 207 < m; ++i) {if(typeof module !== 'undefined' && typeof module.exports !== 'undefined') {
208 < m; ++i) { /* global wasCSVToArray, wasArrayToCSV, wasKeyValueToObject, wasKeyValueGet, wasKeyValueSet */ 208 < m; ++i) { /* global wasCSVToArray, wasArrayToCSV, wasKeyValueToObject, wasKeyValueGet, wasKeyValueSet */
209 < m; ++i) { module.exports.formats = { 209 < m; ++i) { module.exports.formats = {
210 < m; ++i) { csv: { 210 < m; ++i) { csv: {
211 < m; ++i) { CSVToArray: wasCSVToArray, 211 < m; ++i) { CSVToArray: wasCSVToArray,
212 < m; ++i) { ArrayToCSV: wasArrayToCSV 212 < m; ++i) { ArrayToCSV: wasArrayToCSV
213 < m; ++i) { }, 213 < m; ++i) { },
214 < m; ++i) { kvp: { 214 < m; ++i) { kvp: {
215 < m; ++i) { KeyValueToObject: wasKeyValueToObject, 215 < m; ++i) { KeyValueToObject: wasKeyValueToObject,
216 < m; ++i) { KeyValueGet: wasKeyValueGet, 216 < m; ++i) { KeyValueGet: wasKeyValueGet,
217 < m; ++i) { KeyValueSet: wasKeyValueSet 217 < m; ++i) { KeyValueSet: wasKeyValueSet
218 < m; ++i) { } 218 < m; ++i) { }
219 < m; ++i) { }; 219 < m; ++i) { };
220 < m; ++i) {} 220 < m; ++i) {}
221 < m; ++i) { 221 < m; ++i) {
222 < m; ++i) {/* Copyright (C) 2020 Wizardry and Steamworks - License: GNU GPLv3 */ 222 < m; ++i) {/* Copyright (C) 2020 Wizardry and Steamworks - License: GNU GPLv3 */
223 < m; ++i) {/*************************************************************************/ 223 < m; ++i) {/*************************************************************************/
224 < m; ++i) {function wasKeyValueToObject(data) { 224 < m; ++i) {function wasKeyValueToObject(data) {
225 < m; ++i) { var result = {}; 225 < m; ++i) { var result = {};
226 < m; ++i) { data.split('&').forEach((kvp) => { 226 < m; ++i) { data.split('&').forEach((kvp) => {
227 < m; ++i) { var kv = kvp.split('=') 227 < m; ++i) { var kv = kvp.split('=')
228 < m; ++i) { .filter((kv) => 228 < m; ++i) { .filter((kv) =>
229 < m; ++i) { kv[0] !== 'undefined' && kv[1] !== 'undefined'); 229 < m; ++i) { kv[0] !== 'undefined' && kv[1] !== 'undefined');
230 < m; ++i) { result[kv[0]] = kv[1]; 230 < m; ++i) { result[kv[0]] = kv[1];
231 < m; ++i) { 231 < m; ++i) {
232 < m; ++i) { }); 232 < m; ++i) { });
233 < m; ++i) { return result; 233 < m; ++i) { return result;
234 < m; ++i) {} 234 < m; ++i) {}
235 < m; ++i) { 235 < m; ++i) {
236 < m; ++i) {/*************************************************************************/ 236 < m; ++i) {/*************************************************************************/
237 < m; ++i) {/* Copyright (C) 2017 Wizardry and Steamworks - License: GNU GPLv3 */ 237 < m; ++i) {/* Copyright (C) 2017 Wizardry and Steamworks - License: GNU GPLv3 */
238 < m; ++i) {/*************************************************************************/ 238 < m; ++i) {/*************************************************************************/
239 < m; ++i) {function wasKeyValueSet(k, v, data) { 239 < m; ++i) {function wasKeyValueSet(k, v, data) {
240 < m; ++i) { return data.split('&') 240 < m; ++i) { return data.split('&')
241 < m; ++i) { .map(c => c.split('=')[0] === k ? `${k}=${v}` : c) 241 < m; ++i) { .map(c => c.split('=')[0] === k ? `${k}=${v}` : c)
242 < m; ++i) { .concat(`${k}=${v}`) 242 < m; ++i) { .concat(`${k}=${v}`)
243 < m; ++i) { .filter((e,i,s) => s.indexOf(e) === i) 243 < m; ++i) { .filter((e,i,s) => s.indexOf(e) === i)
244 < m; ++i) { .join('&'); 244 < m; ++i) { .join('&');
245 < m; ++i) {} 245 < m; ++i) {}
246 < m; ++i) { 246 < m; ++i) {
247 < m; ++i) { 247 < m; ++i) {
248 < m; ++i) {/*************************************************************************/ 248 < m; ++i) {/*************************************************************************/
249 < m; ++i) {/* Copyright (C) 2017 Wizardry and Steamworks - License: GNU GPLv3 */ 249 < m; ++i) {/* Copyright (C) 2017 Wizardry and Steamworks - License: GNU GPLv3 */
250 < m; ++i) {/*************************************************************************/ 250 < m; ++i) {/*************************************************************************/
251 < m; ++i) {function wasKeyValueGet(k, data) { 251 < m; ++i) {function wasKeyValueGet(k, data) {
252 < m; ++i) { return data.split('&').reduce((a, c) => { 252 < m; ++i) { return data.split('&').reduce((a, c) => {
253 < m; ++i) { var s = c.split('='); 253 < m; ++i) { var s = c.split('=');
254 < m; ++i) { return s[0] === k ? s[1] : a; 254 < m; ++i) { return s[0] === k ? s[1] : a;
255 < m; ++i) { }, ''); 255 < m; ++i) { }, '');
256 < m; ++i) {} 256 < m; ++i) {}
257 < m; ++i) {/* Copyright (C) 2017 Wizardry and Steamworks - License: GNU GPLv3 */ 257 < m; ++i) {/* Copyright (C) 2017 Wizardry and Steamworks - License: GNU GPLv3 */
258 < m; ++i) {/*************************************************************************/ 258 < m; ++i) {/*************************************************************************/
259 < m; ++i) {/* fuss/lambda_calculus/functional_programming/aggregators @ grimore.org */ 259 < m; ++i) {/* fuss/lambda_calculus/functional_programming/aggregators @ grimore.org */
260 < m; ++i) {/*************************************************************************/ 260 < m; ++i) {/*************************************************************************/
261 < m; ++i) {function wasSwitch(q, d, ...c) { 261 < m; ++i) {function wasSwitch(q, d, ...c) {
262 < m; ++i) { if(c.length % 2 !== 0) { 262 < m; ++i) { if(c.length % 2 !== 0) {
263 < m; ++i) { throw "Pairs of predicates expected for cases"; 263 < m; ++i) { throw "Pairs of predicates expected for cases";
264 < m; ++i) { } 264 < m; ++i) { }
265 < m; ++i) { 265 < m; ++i) {
266 < m; ++i) { (Array.isArray(q) ? q : [ q ]).forEach((s) => { 266 < m; ++i) { (Array.isArray(q) ? q : [ q ]).forEach((s) => {
267 < m; ++i) { var m = false; 267 < m; ++i) { var m = false;
268 < m; ++i) { for(var i = 0; i < c.length; i += 2) { 268 < m; ++i) { for(var i = 0; i < c.length; i += 2) {
269 < m; ++i) { if(!c[i](s)) { 269 < m; ++i) { if(!c[i](s)) {
270 < m; ++i) { continue; 270 < m; ++i) { continue;
271 < m; ++i) { } 271 < m; ++i) { }
272 < m; ++i) { if(!c[i + 1](s)) { 272 < m; ++i) { if(!c[i + 1](s)) {
273 < m; ++i) { continue; 273 < m; ++i) { continue;
274 < m; ++i) { } 274 < m; ++i) { }
275 < m; ++i) { m = true; 275 < m; ++i) { m = true;
276 < m; ++i) { } 276 < m; ++i) { }
277 < m; ++i) { 277 < m; ++i) {
278 < m; ++i) { if(!m) { 278 < m; ++i) { if(!m) {
279 < m; ++i) { d(s); 279 < m; ++i) { d(s);
280 < m; ++i) { } 280 < m; ++i) { }
281 < m; ++i) { }); 281 < m; ++i) { });
282 < m; ++i) {} 282 < m; ++i) {}
283 < m; ++i) {if (!Array.prototype.switch) { 283 < m; ++i) {if (!Array.prototype.switch) {
284 < m; ++i) { Array.prototype.switch = function() { 284 < m; ++i) { Array.prototype.switch = function() {
285 < m; ++i) { wasSwitch(this, arguments[0], arguments.slice(1)); 285 < m; ++i) { wasSwitch(this, arguments[0], arguments.slice(1));
286 < m; ++i) { }; 286 < m; ++i) { };
287 < m; ++i) {} 287 < m; ++i) {}
288 < m; ++i) {// jQuery 288 < m; ++i) {// jQuery
289 < m; ++i) {if(typeof jQuery === 'function') { 289 < m; ++i) {if(typeof jQuery === 'function') {
290 < m; ++i) { $.extend({ 290 < m; ++i) { $.extend({
291 < m; ++i) { switch: wasSwitch 291 < m; ++i) { switch: wasSwitch
292 < m; ++i) { }); 292 < m; ++i) { });
293 < m; ++i) {} 293 < m; ++i) {}
294 < m; ++i) { 294 < m; ++i) {
295 < m; ++i) {/*************************************************************************/ 295 < m; ++i) {/*************************************************************************/
296 < m; ++i) {/* Node.JS package export. */ 296 < m; ++i) {/* Node.JS package export. */
297 < m; ++i) {/*************************************************************************/ 297 < m; ++i) {/*************************************************************************/
298 < m; ++i) {if(typeof module !== 'undefined' && typeof module.exports !== 'undefined') { 298 < m; ++i) {if(typeof module !== 'undefined' && typeof module.exports !== 'undefined') {
299 < m; ++i) { module.exports.lambda = { 299 < m; ++i) { module.exports.lambda = {
300 < m; ++i) { switch: wasSwitch 300 < m; ++i) { switch: wasSwitch
301 < m; ++i) { }; 301 < m; ++i) { };
302 < m; ++i) {} 302 < m; ++i) {}
303 < m; ++i) { 303 < m; ++i) {
304 < m; ++i) {/* Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 */ 304 < m; ++i) {/* Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 */
305 < m; ++i) {/*************************************************************************/ 305 < m; ++i) {/*************************************************************************/
306 < m; ++i) {function wasMapValueToRange(value, xMin, xMax, yMin, yMax) { 306 < m; ++i) {function wasMapValueToRange(value, xMin, xMax, yMin, yMax) {
307 < m; ++i) { return yMin + ( 307 < m; ++i) { return yMin + (
308 < m; ++i) { ( yMax - yMin ) * ( value - xMin ) / ( xMax - xMin ) 308 < m; ++i) { ( yMax - yMin ) * ( value - xMin ) / ( xMax - xMin )
309 < m; ++i) { ); 309 < m; ++i) { );
310 < m; ++i) {} 310 < m; ++i) {}
311 < m; ++i) { 311 < m; ++i) {
312 < m; ++i) {/*************************************************************************/ 312 < m; ++i) {/*************************************************************************/
313 < m; ++i) {/* Node.JS package export. */ 313 < m; ++i) {/* Node.JS package export. */
314 < m; ++i) {/*************************************************************************/ 314 < m; ++i) {/*************************************************************************/
315 < m; ++i) {if(typeof module !== 'undefined' && typeof module.exports !== 'undefined') { 315 < m; ++i) {if(typeof module !== 'undefined' && typeof module.exports !== 'undefined') {
316 < m; ++i) { module.exports.mathematics = { 316 < m; ++i) { module.exports.mathematics = {
317 < m; ++i) { MapValueToRange: wasMapValueToRange 317 < m; ++i) { MapValueToRange: wasMapValueToRange
318 < m; ++i) { }; 318 < m; ++i) { };
319 < m; ++i) {} 319 < m; ++i) {}
320 < m; ++i) { 320 < m; ++i) {
321 < m; ++i) {/* Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 */ 321 < m; ++i) {/* Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 */
322 < m; ++i) {/*************************************************************************/ 322 < m; ++i) {/*************************************************************************/
323 < m; ++i) {function wasHexToRGB(hex) { 323 < m; ++i) {function wasHexToRGB(hex) {
324 < m; ++i) { var shortRegEx = /^#?([a-f\d])([a-f\d])([a-f\d])$/i; 324 < m; ++i) { var shortRegEx = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
325 < m; ++i) { hex = hex.replace( 325 < m; ++i) { hex = hex.replace(
326 < m; ++i) { shortRegEx, 326 < m; ++i) { shortRegEx,
327 < m; ++i) { function(m, r, g, b) { 327 < m; ++i) { function(m, r, g, b) {
328 < m; ++i) { return r + r + g + g + b + b; 328 < m; ++i) { return r + r + g + g + b + b;
329 < m; ++i) { } 329 < m; ++i) { }
330 < m; ++i) { ); 330 < m; ++i) { );
331 < m; ++i) { 331 < m; ++i) {
332 < m; ++i) { var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex); 332 < m; ++i) { var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
333 < m; ++i) { return result ? { 333 < m; ++i) { return result ? {
334 < m; ++i) { r: parseInt(result[1], 16), 334 < m; ++i) { r: parseInt(result[1], 16),
335 < m; ++i) { g: parseInt(result[2], 16), 335 < m; ++i) { g: parseInt(result[2], 16),
336 < m; ++i) { b: parseInt(result[3], 16) 336 < m; ++i) { b: parseInt(result[3], 16)
337 < m; ++i) { } : null; 337 < m; ++i) { } : null;
338 < m; ++i) {} 338 < m; ++i) {}
339 < m; ++i) { 339 < m; ++i) {
340 < m; ++i) {/*************************************************************************/ 340 < m; ++i) {/*************************************************************************/
341 < m; ++i) {/* Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 */ 341 < m; ++i) {/* Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 */
342 < m; ++i) {/*************************************************************************/ 342 < m; ++i) {/*************************************************************************/
343 < m; ++i) {function wasRGBToHex(r, g, b) { 343 < m; ++i) {function wasRGBToHex(r, g, b) {
344 < m; ++i) { return "#" + ( 344 < m; ++i) { return "#" + (
345 < m; ++i) { (1 << 24) + 345 < m; ++i) { (1 << 24) +
346 < m; ++i) {<< 24) +< 24) + (r << 16) + 346 < m; ++i) {<< 24) +< 24) + (r << 16) +
347 < m; ++i) {<< 24) +< 24) +<< 16) +< 16) + (g << 8) + 347 < m; ++i) {<< 24) +< 24) +<< 16) +< 16) + (g << 8) +
348 < m; ++i) {<< 24) +< 24) +<< 16) +< 16) +<< 8) +< 8) + b 348 < m; ++i) {<< 24) +< 24) +<< 16) +< 16) +<< 8) +< 8) + b
349 < m; ++i) {<< 24) +< 24) +<< 16) +< 16) +<< 8) +< 8) + ).toString(16).slice(1); 349 < m; ++i) {<< 24) +< 24) +<< 16) +< 16) +<< 8) +< 8) + ).toString(16).slice(1);
350 < m; ++i) {<< 24) +< 24) +<< 16) +< 16) +<< 8) +< 8) +} 350 < m; ++i) {<< 24) +< 24) +<< 16) +< 16) +<< 8) +< 8) +}
351 < m; ++i) {<< 24) +< 24) +<< 16) +< 16) +<< 8) +< 8) + 351 < m; ++i) {<< 24) +< 24) +<< 16) +< 16) +<< 8) +< 8) +
352 < m; ++i) {<< 24) +< 24) +<< 16) +< 16) +<< 8) +< 8) +/*************************************************************************/ 352 < m; ++i) {<< 24) +< 24) +<< 16) +< 16) +<< 8) +< 8) +/*************************************************************************/
353 < m; ++i) {<< 24) +< 24) +<< 16) +< 16) +<< 8) +< 8) +/* Node.JS package export. */ 353 < m; ++i) {<< 24) +< 24) +<< 16) +< 16) +<< 8) +< 8) +/* Node.JS package export. */
354 < m; ++i) {<< 24) +< 24) +<< 16) +< 16) +<< 8) +< 8) +/*************************************************************************/ 354 < m; ++i) {<< 24) +< 24) +<< 16) +< 16) +<< 8) +< 8) +/*************************************************************************/
355 < m; ++i) {<< 24) +< 24) +<< 16) +< 16) +<< 8) +< 8) +if(typeof module !== 'undefined' && typeof module.exports !== 'undefined') { 355 < m; ++i) {<< 24) +< 24) +<< 16) +< 16) +<< 8) +< 8) +if(typeof module !== 'undefined' && typeof module.exports !== 'undefined') {
356 < m; ++i) {<< 24) +< 24) +<< 16) +< 16) +<< 8) +< 8) + module.exports.physics = { 356 < m; ++i) {<< 24) +< 24) +<< 16) +< 16) +<< 8) +< 8) + module.exports.physics = {
357 < m; ++i) {<< 24) +< 24) +<< 16) +< 16) +<< 8) +< 8) + HexToRGB: wasHexToRGB, 357 < m; ++i) {<< 24) +< 24) +<< 16) +< 16) +<< 8) +< 8) + HexToRGB: wasHexToRGB,
358 < m; ++i) {<< 24) +< 24) +<< 16) +< 16) +<< 8) +< 8) + RGBToHex: wasRGBToHex 358 < m; ++i) {<< 24) +< 24) +<< 16) +< 16) +<< 8) +< 8) + RGBToHex: wasRGBToHex
359 < m; ++i) {<< 24) +< 24) +<< 16) +< 16) +<< 8) +< 8) + }; 359 < m; ++i) {<< 24) +< 24) +<< 16) +< 16) +<< 8) +< 8) + };
360 < m; ++i) {<< 24) +< 24) +<< 16) +< 16) +<< 8) +< 8) +} 360 < m; ++i) {<< 24) +< 24) +<< 16) +< 16) +<< 8) +< 8) +}
361 < m; ++i) {<< 24) +< 24) +<< 16) +< 16) +<< 8) +< 8) + 361 < m; ++i) {<< 24) +< 24) +<< 16) +< 16) +<< 8) +< 8) +
362 < m; ++i) {<< 24) +< 24) +<< 16) +< 16) +<< 8) +< 8) +
362 < m; ++i) {<< 24) +< 24) +<< 16) +< 16) +<< 8) +< 8) +
363 < m; ++i) {<< 24) +< 24) +<< 16) +< 16) +<< 8) +< 8) +
Generated by GNU Enscript 1.6.5.90.
363 < m; ++i) {<< 24) +< 24) +<< 16) +< 16) +<< 8) +< 8) +
Generated by GNU Enscript 1.6.5.90.
364 < m; ++i) {<< 24) +< 24) +<< 16) +< 16) +<< 8) +< 8) +
364 < m; ++i) {<< 24) +< 24) +<< 16) +< 16) +<< 8) +< 8) +
365 < m; ++i) {<< 24) +< 24) +<< 16) +< 16) +<< 8) +< 8) +
365 < m; ++i) {<< 24) +< 24) +<< 16) +< 16) +<< 8) +< 8) +
366 < m; ++i) {<< 24) +< 24) +<< 16) +< 16) +<< 8) +< 8) +
366 < m; ++i) {<< 24) +< 24) +<< 16) +< 16) +<< 8) +< 8) +