was.js – Diff between revs 12 and 24

Subversion Repositories:
Rev:
Show entire fileIgnore whitespace
Rev 12 Rev 24
Line 1... Line 1...
1 /*! was - v1.0.0 - 2017-05-29 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 */
4 /* Copyright (C) 2017 Wizardry and Steamworks - License: GNU GPLv3 */ 4 /* Copyright (C) 2017 Wizardry and Steamworks - License: GNU GPLv3 */
5 /*************************************************************************/ 5 /*************************************************************************/
6 if (!Array.prototype.product) { 6 if (!Array.prototype.product) {
Line 200... Line 200...
200 o[c[0]] = c[1]; 200 o[c[0]] = c[1];
201 }, o); 201 }, o);
202 return o; 202 return o;
203 } 203 }
Line -... Line 204...
-   204  
-   205 /* Copyright (C) 2017 Wizardry and Steamworks - License: GNU GPLv3 */
-   206 /*************************************************************************/
-   207 /* fuss/lambda_calculus/functional_programming/aggregators @ grimore.org */
-   208 /*************************************************************************/
-   209 function wasSwitch(q, d, ...c) {
-   210 if(c.length % 2 !== 0) {
-   211 throw "Pairs of predicates expected for cases";
-   212 }
-   213
-   214 (Array.isArray(this) ? this : [ this ]).forEach((s) => {
-   215 var m = false;
-   216 for(var i = 0; i < c.length; i += 2) {
-   217 if(!c[i](s)) {
-   218 continue;
-   219 }
-   220 if(!c[i + 1](s)) {
-   221 continue;
-   222 }
-   223 m = true;
-   224 }
-   225
-   226 if(!m) {
-   227 d(s);
-   228 }
-   229 });
-   230 }
-   231  
-   232 // Vanilla ES6 JavaScript
-   233 if (!Array.prototype.switch) {
-   234 Array.prototype.switch = wasSwitch;
-   235 }
-   236 // jQuery
-   237 if(typeof jQuery === 'function') {
-   238 $.extend({
-   239 switch: wasSwitch
-   240 });
-   241 }
-   242 // Node.JS
-   243 module.exports = {
-   244 switch: wasSwitch
-   245 };
204   246  
205 /* Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 */ 247 /* Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 */
206 /*************************************************************************/ 248 /*************************************************************************/
207 function wasMapValueToRange(value, xMin, xMax, yMin, yMax) { 249 function wasMapValueToRange(value, xMin, xMax, yMin, yMax) {
208 return yMin + ( 250 return yMin + (