was.js – Blame information for rev 51

Subversion Repositories:
Rev:
Rev Author Line No. Line
51 office 1 /*! was.js - v1.0.8 - 2020-12-08
3 office 2 * http://grimore.org
48 office 3 * Copyright (c) 2020 [object Object]; Licensed GPL-3.0 */
24 office 4  
51 office 5 function wasProduct(e,t){for(var r=Math.max(e.length,t.length),o={},n=0;n<r;++n)o[e[n]]=t[n];return o}function wasStride(e,t){return e.filter(function(e,r){return r%t==0})}function wasChunk(e,t){return Array.from(new Array(Math.ceil(e.length/t)),(r,o)=>e.slice(o*t,o*t+t))}function wasEquals(e,t){if(!t)return!1;if(e.length!==t.length)return!1;for(var r=0,o=e.length;r"\s,\r\n/.test(o)?t[r]='"'+o+'"':t[r]=o}return t.join()}function wasKeyValueToObject(e){var t={};return e.reduce(function(e,t,r){return e[r=Math.floor(r/2)]||(e[r]=[]),e[r].push(t),e},[]).forEach(function(e,r,o){t[e[0]]=e[1]},t),t}function wasKeyValueSet(e,t,r){return r.split("&").map(r=>r.split("=")[0]===e?`${e}=${t}`:r).concat(`${e}=${t}`).filter((e,t,r)=>r.indexOf(e)===t).join("&")}function wasKeyValueGet(e,t){return t.split("&").reduce((t,r)=>{var o=r.split("=");return o[0]===e?o[1]:t},"")}function wasSwitch(e,t,...r){if(r.length%2!=0)throw"Pairs of predicates expected for cases";(Array.isArray(e)?e:[e]).forEach(e=>{for(var o=!1,n=0;n<r.length;n+=2)r[n](e)&&r[n+1](e)&&(o=!0);o||t(e)})}function wasMapValueToRange(e,t,r,o,n){return o+(n-o)*(e-t)/(r-t)}function wasHexToRGB(e){e=e.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,function(e,t,r,o){return t+t+r+r+o+o});var t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?{r:parseInt(t[1],16),g:parseInt(t[2],16),b:parseInt(t[3],16)}:null}function wasRGBToHex(e,t,r){return"#"+((1<<24)+(e<<16)+(t<<8)+r).toString(16).slice(1)}Array.prototype.product||(Array.prototype.product=function(e){return wasProduct(this,e)}),"function"==typeof jQuery&&$.extend({product:wasProduct}),Array.prototype.stride||(Array.prototype.stride=function(e){return wasStride(this,e)}),"function"==typeof jQuery&&$.extend({stride:wasStride}),Array.prototype.chunk||(Array.prototype.chunk=function(e,t){return wasChunk(this,t)}),"function"==typeof jQuery&&$.extend({chunk:wasChunk}),Array.prototype.equals||(Array.prototype.equals=function(e,t){return wasEquals(this,t)}),"function"==typeof jQuery&&$.extend({equals:wasEquals}),"undefined"!=typeof module&&void 0!==module.exports&&(module.exports.collections={product:wasProduct,stride:wasStride,chunk:wasChunk,equals:wasEquals}),"undefined"!=typeof module&&void 0!==module.exports&&(module.exports.formats={csv:{CSVToArray:wasCSVToArray,ArrayToCSV:wasArrayToCSV},kvp:{KeyValueToObject:wasKeyValueToObject,KeyValueGet:wasKeyValueGet,KeyValueSet:wasKeyValueSet}}),Array.prototype.switch||(Array.prototype.switch=function(){wasSwitch(this,arguments[0],arguments.slice(1))}),"function"==typeof jQuery&&$.extend({switch:wasSwitch}),"undefined"!=typeof module&&void 0!==module.exports&&(module.exports.lambda={switch:wasSwitch}),"undefined"!=typeof module&&void 0!==module.exports&&(module.exports.mathematics={MapValueToRange:wasMapValueToRange}),"undefined"!=typeof module&&void 0!==module.exports&&(module.exports.physics={HexToRGB:wasHexToRGB,RGBToHex:wasRGBToHex});