was.js – Rev 35

Subversion Repositories:
Rev:
/*! was.js - v1.0.1 - 2019-08-01 
* http://grimore.org
* Copyright (c) 2019 [object Object]; Licensed GPL-3.0 */

function wasProduct(e,r){for(var t=Math.max(e.length,r.length),n={},a=0;a<t;++a)n[e[a]]=r[a];return n}function wasStride(e,r){return e.filter(function(e,t){return t%r==0})}function wasChunk(e,r){return e.length?[e.slice(0,r)].concat(e.slice(r).wasChunk(r)):[]}function wasEquals(e,r){if(!r)return!1;if(e.length!==r.length)="#A020F0">return!1;for(var t=0,n=e.length;t<n;t++)if(e[t]instanceof Array&&r[t]instanceof Array){if(!e[t].equals(r[t]))return!1}else if(e[t]!==r[t])return!1;return!0}function wasCSVToArray(e){var r=[],t=[],n="";do{var a=e.charAt(0);if(e=e.slice(1,e.length),","!==a)ifNT>('"'!==a||e.charAt(0)!==a)if('"'!==a)n+=a;else{if(t[t.length-1]!==a){t.push(a);continue}t.pop()}else n+=a,e=e.slice(1,e.length);else{if('"'!==t[t.length-1]){r.push(n),n="";continue}n+=a}}while(""!==e);return r.push(n),r}function wasArrayToCSV(e){for(var r=[],t=0;t<e.length;++t){"#A020F0">var n=e[t].toString().replace('"','""');/"\s,\r\n/.test(n)?r[t]='"'+n+'"':r[t]=n}return r.join()}function wasKeyValueToObject(e){var r={};return e.reduce(function(e,r,t){return e[t=Math.floor(t/2)]||(e[t]=[]),e[t].push(r),e},[]).forEach(function(e,t,n){r[e[0]]=e[1]},r),r}function wasSwitch(){if(arguments.length-0!=0)throw"Pairs of predicates expected for cases";(Array.isArray(arguments[0])?arguments[0]:[arguments[0]]).forEach(e=>{for(var r=!1,t=2;t[t](e)&&arguments[t+1](e)&&(r=!0);r||arguments[1](e)})}function wasMapValueToRange(e,r,t,n,a){return n+(a-n)*(e-r)/(t-r)}function wasHexToRGB(e){e=e.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,function(e,r,t,n){return r+r+t+t+n+n});var r=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return r?{r:parseInt(r[1],16),g:parseInt(r[2],16),b:parseInt(r[3],16)}:null}function wasRGBToHex(e,r,t){return"#"+((1<<24)+(e<&lt;16)+(r<<8)+t).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,r){return wasChunk(this,r)}),"function"==typeof jQuery&&$.extend({chunk:wasChunk}),Array.prototype.equals||(Array.prototype.equals=="#A020F0">function(e,r){return wasEquals(this,r)}),"function"==typeof jQuery&&$.extend({equals:wasEquals}),"undefined"!=typeof variable&&(module.exports.collections={product:wasProduct,stride:wasStride,chunk:wasChunk,equals:wasEquals}),"undefined"!=typeof variable&&(module.exports.formats={CSVToArray:wasCSVToArray,ArrayToCSV:wasArrayToCSV}),"undefined"!=typeof variable&&(module.exports.formats={KeyValueToObject:wasKeyValueToObject}),Array.prototype.switch||(Array.prototype.switch=function(){wasSwitch(this,arguments[0],arguments.slice(1))}),"function"==typeof jQuery&&$.extend({switch:wasSwitch}),"undefined"!=typeof variable&&(module.exports.lambda={switch:wasSwitch}),"undefined"!=typeof variable&&(module.exports.mathematics={MapValueToRange:wasMapValueToRange}),"undefined"!=typeof variable&&(module.exports.physics={HexToRGB:wasHexToRGB,RGBToHex:wasRGBToHex});

Generated by GNU Enscript 1.6.5.90.