UNPKG

gammautils

Version:

Lots of utilities for Node.js

2 lines 120 kB
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.gammautils=e()}}(function(){var define,module,exports;return function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}({1:[function(_dereq_,module,exports){"use strict";module.exports={array:_dereq_("./lib/arrayUtils"),console:_dereq_("./lib/consoleUtils"),crypto:_dereq_("./lib/cryptoUtils"),controller:_dereq_("./lib/controllerUtils"),date:_dereq_("./lib/dateUtils"),error:_dereq_("./lib/errorUtils"),env:_dereq_("./lib/envUtils"),timezone:_dereq_("./lib/timezoneUtils"),fs:_dereq_("./lib/fsUtils"),math:_dereq_("./lib/mathUtils"),number:_dereq_("./lib/numberUtils"),object:_dereq_("./lib/objectUtils"),string:_dereq_("./lib/stringUtils"),http:_dereq_("./lib/httpUtils"),"boolean":_dereq_("./lib/booleanUtils"),recomendation:_dereq_("./lib/recomendationUtils"),url:_dereq_("./lib/urlUtils"),validation:_dereq_("./lib/validationUtils"),barcode:_dereq_("./lib/barcodeUtils"),regExp:_dereq_("./lib/regExpUtils")}},{"./lib/arrayUtils":3,"./lib/barcodeUtils":4,"./lib/booleanUtils":5,"./lib/consoleUtils":6,"./lib/controllerUtils":7,"./lib/cryptoUtils":8,"./lib/dateUtils":9,"./lib/envUtils":10,"./lib/errorUtils":11,"./lib/fsUtils":12,"./lib/httpUtils":13,"./lib/mathUtils":14,"./lib/numberUtils":16,"./lib/objectUtils":17,"./lib/recomendationUtils":18,"./lib/regExpUtils":19,"./lib/stringUtils":20,"./lib/timezoneUtils":21,"./lib/urlUtils":33,"./lib/validationUtils":34}],2:[function(_dereq_,module,exports){"use strict";module.exports={"ẚ":"a","Á":"A","á":"a","À":"A","à":"a","Ă":"A","ă":"a","Ắ":"A","ắ":"a","Ằ":"A","ằ":"a","Ẵ":"A","ẵ":"a","Ẳ":"A","ẳ":"a","Â":"A","â":"a","Ấ":"A","ấ":"a","Ầ":"A","ầ":"a","Ẫ":"A","ẫ":"a","Ẩ":"A","ẩ":"a","Ǎ":"A","ǎ":"a","Å":"A","å":"a","Ǻ":"A","ǻ":"a","Ä":"A","ä":"a","Ǟ":"A","ǟ":"a","Ã":"A","ã":"a","Ȧ":"A","ȧ":"a","Ǡ":"A","ǡ":"a","Ą":"A","ą":"a","Ā":"A","ā":"a","Ả":"A","ả":"a","Ȁ":"A","ȁ":"a","Ȃ":"A","ȃ":"a","Ạ":"A","ạ":"a","Ặ":"A","ặ":"a","Ậ":"A","ậ":"a","Ḁ":"A","ḁ":"a","Ⱥ":"A","ⱥ":"a","Ǽ":"A","ǽ":"a","Ǣ":"A","ǣ":"a","Ḃ":"B","ḃ":"b","Ḅ":"B","ḅ":"b","Ḇ":"B","ḇ":"b","Ƀ":"B","ƀ":"b","ᵬ":"B","Ɓ":"b","ɓ":"b","Ƃ":"b","ƃ":"b","Ć":"C","ć":"c","Ĉ":"C","ĉ":"c","Č":"C","č":"c","Ċ":"C","ċ":"c","Ç":"C","ç":"c","Ḉ":"C","ḉ":"c","Ȼ":"C","ȼ":"c","Ƈ":"C","ƈ":"c","ɕ":"c","Ď":"D","ď":"d","Ḋ":"D","ḋ":"d","Ḑ":"D","ḑ":"d","Ḍ":"D","ḍ":"d","Ḓ":"D","ḓ":"d","Ḏ":"D","ḏ":"d","Đ":"D","đ":"d","ᵭ":"d","Ɖ":"D","ɖ":"d","Ɗ":"D","ɗ":"d","Ƌ":"d","ƌ":"d","ȡ":"d","ð":"d","É":"E","Ə":"e","Ǝ":"E","ǝ":"e","é":"e","È":"E","è":"e","Ĕ":"E","ĕ":"e","Ê":"E","ê":"e","Ế":"E","ế":"e","Ề":"E","ề":"e","Ễ":"E","ễ":"e","Ể":"E","ể":"e","Ě":"E","ě":"e","Ë":"E","ë":"e","Ẽ":"E","ẽ":"e","Ė":"E","ė":"e","Ȩ":"E","ȩ":"e","Ḝ":"E","ḝ":"e","Ę":"E","ę":"e","Ē":"E","ē":"e","Ḗ":"E","ḗ":"e","Ḕ":"E","ḕ":"e","Ẻ":"E","ẻ":"e","Ȅ":"E","ȅ":"e","Ȇ":"E","ȇ":"e","Ẹ":"E","ẹ":"e","Ệ":"E","ệ":"e","Ḙ":"E","ḙ":"e","Ḛ":"E","ḛ":"e","Ɇ":"E","ɇ":"e","ɚ":"e","ɝ":"e","Ḟ":"F","ḟ":"f","ᵮ":"f","Ƒ":"F","ƒ":"f","Ǵ":"G","ǵ":"g","Ğ":"G","ğ":"g","Ĝ":"G","ĝ":"g","Ǧ":"G","ǧ":"g","Ġ":"G","ġ":"g","Ģ":"G","ģ":"g","Ḡ":"G","ḡ":"g","Ǥ":"G","ǥ":"g","Ɠ":"G","ɠ":"g","Ĥ":"H","ĥ":"h","Ȟ":"H","ȟ":"h","Ḧ":"H","ḧ":"h","Ḣ":"H","ḣ":"h","Ḩ":"H","ḩ":"h","Ḥ":"H","ḥ":"h","Ḫ":"H","ḫ":"h",H:"H","̱":"h","ẖ":"h","Ħ":"H","ħ":"h","Ⱨ":"H","ⱨ":"h","Í":"I","í":"i","Ì":"I","ì":"i","Ĭ":"I","ĭ":"i","Î":"I","î":"i","Ǐ":"I","ǐ":"i","Ï":"I","ï":"i","Ḯ":"I","ḯ":"i","Ĩ":"I","ĩ":"i","İ":"I",i:"i","Į":"I","į":"i","Ī":"I","ī":"i","Ỉ":"I","ỉ":"i","Ȉ":"I","ȉ":"i","Ȋ":"I","ȋ":"i","Ị":"I","ị":"i","Ḭ":"I","ḭ":"i",I:"I","ı":"i","Ɨ":"I","ɨ":"i","Ĵ":"J","ĵ":"j",J:"J","̌":"j","ǰ":"j","ȷ":"j","Ɉ":"J","ɉ":"j","ʝ":"j","ɟ":"j","ʄ":"j","Ḱ":"K","ḱ":"k","Ǩ":"k","ǩ":"k","Ķ":"k","ķ":"k","Ḳ":"k","ḳ":"k","Ḵ":"k","ḵ":"k","Ƙ":"k","ƙ":"k","Ⱪ":"k","ⱪ":"k","Ĺ":"a","ĺ":"l","Ľ":"L","ľ":"l","Ļ":"L","ļ":"l","Ḷ":"l","ḷ":"l","Ḹ":"l","ḹ":"l","Ḽ":"L","ḽ":"l","Ḻ":"l","ḻ":"l","Ł":"l","ł":"l","̣":"l","Ŀ":"l","ŀ":"l","Ƚ":"l","ƚ":"l","Ⱡ":"l","ⱡ":"l","Ɫ":"l","ɫ":"l","ɬ":"l","ɭ":"l","ȴ":"l","Ḿ":"M","ḿ":"m","Ṁ":"M","ṁ":"m","Ṃ":"M","ṃ":"m","ɱ":"m","Ń":"N","ń":"n","Ǹ":"N","ǹ":"n","Ň":"N","ň":"n","Ñ":"N","ñ":"n","Ṅ":"N","ṅ":"n","Ņ":"N","ņ":"n","Ṇ":"N","ṇ":"n","Ṋ":"N","ṋ":"n","Ṉ":"N","ṉ":"n","Ɲ":"N","ɲ":"n","Ƞ":"n","ƞ":"n","ɳ":"n","ȵ":"n",N:"N",n:"n","̈":"n","Ó":"O","ó":"o","Ò":"O","ò":"o","Ŏ":"O","ŏ":"o","Ô":"O","ô":"o","Ố":"O","ố":"o","Ồ":"O","ồ":"o","Ỗ":"O","ỗ":"o","Ổ":"O","ổ":"o","Ǒ":"O","ǒ":"o","Ö":"O","ö":"o","Ȫ":"O","ȫ":"o","Ő":"O","ő":"o","Õ":"O","õ":"o","Ṍ":"O","ṍ":"o","Ṏ":"O","ṏ":"o","Ȭ":"O","ȭ":"o","Ȯ":"O","ȯ":"o","Ȱ":"O","ȱ":"o","Ø":"O","ø":"o","Ǿ":"O","ǿ":"o","Ǫ":"O","ǫ":"o","Ǭ":"O","ǭ":"o","Ō":"O","ō":"o","Ṓ":"O","ṓ":"o","Ṑ":"O","ṑ":"o","Ỏ":"O","ỏ":"o","Ȍ":"O","ȍ":"o","Ȏ":"O","ȏ":"o","Ơ":"O","ơ":"o","Ớ":"O","ớ":"o","Ờ":"O","ờ":"o","Ỡ":"O","ỡ":"o","Ở":"O","ở":"o","Ợ":"O","ợ":"o","Ọ":"O","ọ":"o","Ộ":"O","ộ":"o","Ɵ":"O","ɵ":"o","Ṕ":"p","ṕ":"p","Ṗ":"p","ṗ":"p","Ᵽ":"p","Ƥ":"p","ƥ":"p",P:"P",p:"p","̃":"p","ʠ":"q","Ɋ":"q","ɋ":"q","Ŕ":"R","ŕ":"r","Ř":"R","ř":"r","Ṙ":"R","ṙ":"r","Ŗ":"R","ŗ":"r","Ȑ":"R","ȑ":"r","Ȓ":"R","ȓ":"r","Ṛ":"R","ṛ":"r","Ṝ":"R","ṝ":"r","Ṟ":"R","ṟ":"r","Ɍ":"R","ɍ":"r","ᵲ":"r","ɼ":"r","Ɽ":"R","ɽ":"r","ɾ":"r","ᵳ":"r","ß":"s","Ś":"s","ś":"s","Ṥ":"S","ṥ":"s","Ŝ":"s","ŝ":"s","Š":"S","š":"s","Ṧ":"S","ṧ":"s","Ṡ":"S","ṡ":"s","ẛ":"s","Ş":"s","ş":"s","Ṣ":"S","ṣ":"s","Ṩ":"S","ṩ":"s","Ș":"S","ș":"s","ʂ":"s",S:"S",s:"s","̩":"s","Þ":"t","þ":"t","Ť":"t","ť":"t",T:"T","ẗ":"t","Ṫ":"T","ṫ":"t","Ţ":"T","ţ":"t","Ṭ":"T","ṭ":"t","Ț":"T","ț":"t","Ṱ":"T","ṱ":"t","Ṯ":"T","ṯ":"t","Ŧ":"T","ŧ":"t","Ⱦ":"t","ⱦ":"t","ᵵ":"t","ƫ":"t","Ƭ":"T","ƭ":"t","Ʈ":"t","ʈ":"t","ȶ":"t","Ú":"U","ú":"u","Ù":"U","ù":"u","Ŭ":"U","ŭ":"u","Û":"U","û":"u","Ǔ":"U","ǔ":"u","Ů":"U","ů":"u","Ü":"U","ü":"u","Ǘ":"U","ǘ":"u","Ǜ":"U","ǜ":"u","Ǚ":"U","ǚ":"u","Ǖ":"U","ǖ":"u","Ű":"U","ű":"u","Ũ":"U","ũ":"u","Ṹ":"U","ṹ":"u","Ų":"U","ų":"u","Ū":"U","ū":"u","Ṻ":"U","ṻ":"u","Ủ":"U","ủ":"u","Ȕ":"U","ȕ":"u","Ȗ":"U","ȗ":"u","Ư":"U","ư":"u","Ứ":"U","ứ":"u","Ừ":"U","ừ":"u","Ữ":"U","ữ":"u","Ử":"U","ử":"u","Ự":"U","ự":"u","Ụ":"U","ụ":"u","Ṳ":"U","ṳ":"u","Ṷ":"U","ṷ":"u","Ṵ":"U","ṵ":"u","Ʉ":"U","ʉ":"u","Ṽ":"V","ṽ":"v","Ṿ":"v","ṿ":"v","Ʋ":"v","ʋ":"v","Ẃ":"W","ẃ":"w","Ẁ":"W","ẁ":"w","Ŵ":"W","ŵ":"w",W:"W","ẘ":"w","Ẅ":"W","ẅ":"w","Ẇ":"W","ẇ":"w","Ẉ":"W","ẉ":"w","Ẍ":"X","ẍ":"x","Ẋ":"X","ẋ":"x","Ý":"Y","ý":"y","Ỳ":"Y","ỳ":"y","Ŷ":"Y","ŷ":"y",Y:"Y","̊":"y","ẙ":"y","Ÿ":"Y","ÿ":"y","Ỹ":"Y","ỹ":"y","Ẏ":"Y","ẏ":"y","Ȳ":"Y","ȳ":"y","Ỷ":"Y","ỷ":"y","Ỵ":"Y","ỵ":"y","ʏ":"Y","Ɏ":"y","ɏ":"y","Ƴ":"Y","ƴ":"y","Ź":"Z","ź":"z","Ẑ":"Z","ẑ":"z","Ž":"Z","ž":"z","Ż":"Z","ż":"z","Ẓ":"Z","ẓ":"z","Ẕ":"Z","ẕ":"z","Ƶ":"Z","ƶ":"z","Ȥ":"Z","ȥ":"z","ʐ":"z","ʑ":"z","Ⱬ":"Z","ⱬ":"z","Ǯ":"z","ǯ":"z","ƺ":"z","2":"2","6":"6","B":"B","F":"F","J":"J","N":"N","R":"R","V":"V","Z":"Z","b":"b","f":"f","j":"j","n":"n","r":"r","v":"v","z":"z","1":"1","5":"5","9":"9","A":"A","E":"E","I":"I","M":"M","Q":"Q","U":"U","Y":"Y","a":"a","e":"e","i":"i","m":"m","q":"q","u":"u","y":"y","0":"0","4":"4","8":"8","D":"D","H":"H","L":"L","P":"P","T":"T","X":"X","d":"d","h":"h","l":"l","p":"p","t":"t","x":"x","3":"3","7":"7","C":"C","G":"G","K":"K","O":"O","S":"S","W":"W","c":"c","g":"g","k":"k","o":"o","s":"s","w":"w"}},{}],3:[function(_dereq_,module,exports){"use strict";var objectUtils=_dereq_("./objectUtils"),util=_dereq_("util"),mathUtils=_dereq_("./mathUtils"),arrayUtils=module.exports;module.exports.__name="Array";module.exports.__description="Utilities for dealing with arrays";function Group(type){if(typeof type==="undefined"){type="array"}else{type="single"}var self=this,data={};this.length=0;this.add=function(key,value,meta){value={value:value,meta:meta};if(type==="array"){if(typeof data[key]==="undefined"){this.length++;data[key]=[]}data[key].push(value)}else{if(typeof data[key]==="undefined"){this.length++}data[key]=value}return self};this.remove=function(key){if(typeof data[key]!=="undefined"){delete data[key];this.length--}};this.addIfNone=function(key,value,meta){if(typeof data[key]==="undefined"){if(typeof value==="function"){value=value()}return this.add(key,value,meta)}return self};this.get=function(key){return data[key]};this.forEach=function(fn){for(var prop in data){if(data.hasOwnProperty(prop)){fn(prop,data[prop])}}return self};this.raw=function(){return data}}module.exports.Group=Group;module.exports.pushIfNotAlready=function(array,item){if(array.indexOf(item)===-1){array.push(item)}return array};function shuffle(array){var currentIndex=array.length,temporaryValue,randomIndex;while(0!==currentIndex){randomIndex=Math.floor(Math.random()*currentIndex);currentIndex-=1;temporaryValue=array[currentIndex];array[currentIndex]=array[randomIndex];array[randomIndex]=temporaryValue}return array}module.exports.shuffle=shuffle;function groupBySync(array,groupingFunction,toArray){var result={};array.forEach(function(item,index){var prop=groupingFunction(item,index),value;if(Array.isArray(prop)){value=prop[1];prop=prop[0]}else if(typeof prop==="object"){value=prop.value;prop=prop.group}else{value=item}if(result[prop]){result[prop].push(value)}else{result[prop]=[value]}});if(toArray){var result2=[];for(var groupName in result){if(result.hasOwnProperty(groupName)){result2.push(toArray(groupName,result[groupName]))}}result=result2}return result}module.exports.groupBySync=groupBySync;function groupBy(array,groupingFunction,toArray,cb){if(objectUtils.isUndefined(cb)){cb=toArray;toArray=null}var result={},index=0;function getGroup(item){groupingFunction(item,function(err,prop){if(err){return cb(err)}var value;if(Array.isArray(prop)){value=prop[1];prop=prop[0]}else if(typeof prop==="object"){value=prop.value;prop=prop.group}else{value=item}if(result[prop]){result[prop].push(value)}else{result[prop]=[value]}if(index===array.length-1){processGroups()}else{index=index+1;getGroup(array[index])}})}getGroup(array[index]);function processGroups(){if(toArray){var result2=[];for(var groupName in result){if(result.hasOwnProperty(groupName)){result2.push(toArray(groupName,result[groupName]))}}result=result2}cb(null,result)}}module.exports.groupBy=groupBy;module.exports.sort=function(array,options){options=objectUtils.merge({order:"asc",deep:true,transform:function(value){return value}},options);var getFromProperty=!objectUtils.isUndefined(options.property);options.order=options.order==="asc"?1:-1;return array.sort(function sorter(a,b){a=getFromProperty?objectUtils.resolveProperty(a,options.property,options.deep):a;b=getFromProperty?objectUtils.resolveProperty(b,options.property,options.deep):b;a=options.transform(a);b=options.transform(b);if(objectUtils.isString(a)&&objectUtils.isString(b)){return a.localeCompare(b)*options.order}return(a-b)*options.order})};module.exports.toUpperCase=function(array){return array.map(function(item){return typeof item==="string"?item.toUpperCase():item})};module.exports.toLowerCase=function(array){return array.map(function(item){return typeof item==="string"?item.toLowerCase():item})};module.exports.getRandomItem=function(array){return array[Math.floor(Math.random()*array.length)]};module.exports.getRandomItem.__docs={description:"Returns a random item from the array",parameters:[{name:"array",type:"array",optional:false,description:"The array where the element will be extracted"}],example:function(){return arrayUtils.getRandomItem([1,2,3,4])}};function getNumberFrom(object,property){var getFromProperty=typeof property!=="undefined";return parseFloat(getFromProperty?util.isDate(object[property])?object[property].valueOf():object[property]:object,10)}function findByComparator(array,strategy,property){var getFromProperty=typeof property!=="undefined";return array.reduce(function(a,b,index){a=getNumberFrom(a,property);b=getNumberFrom(b,property);var found=strategy(a,b);if(getFromProperty){var result={};result[property]=found;return index===array.length-1?found:result}else{return found}})}module.exports.smaller=function(array,property){return findByComparator(array,mathUtils.smaller,property)};module.exports.bigger=function(array,property){return findByComparator(array,mathUtils.bigger,property)};module.exports.average=function(array){return array.reduce(function(a,b){return parseInt(a,10)+parseInt(b,10)})/array.length};module.exports.movingAverage=function(array,length){var result=[];if(array.length<length){return result}var accumulator=0;for(var i=length-1;i<array.length;i++){for(var j=0;j<length;j++){accumulator+=parseFloat(array[i-j],10)}result.push(accumulator/length);accumulator=0}return result};module.exports.movingAverage._docs={description:"Returns an array containing the values of the moving avarage of the given array",parameters:[{name:"array",type:"array",optional:false,description:"The source array where the element will be extracted"},{name:"length",type:"number",optional:false,description:"The number of samples to calculate get the average. This value can't be greater than the array length"}]};function getValue(element,property){if(objectUtils.isNumber(element)){return parseFloat(element,10)}else if(objectUtils.isString(element)){return element}else if(property in element){return parseFloat(element[property],10)}else{throw new Error('Property "'+property+"\" was not found on array's element")}}module.exports.multiply=function(array,property){return array.reduce(function(a,b){return getValue(a,property)*getValue(b,property)},1)};module.exports.multiply.__docs={description:"Multiplies every element within an array",parameters:[{name:"array",optional:false,description:"The source array"},{name:"propety",type:"string",optional:true,description:"If the array contains objects instead of numbers this property represents what property of the object will be multiplied"}]};function sum(array,property,fn){if(objectUtils.isUndefined(fn)){fn=function(a,b,index){if(index===0&&typeof b==="string"){a=""}if(index===0&&typeof b!=="string"){a=0}return getValue(a,property)+getValue(b,property)}}return array.reduce(fn,0)}module.exports.sum=sum;function removeAt(array,index){array.splice(index,1)}module.exports.removeAt=removeAt;module.exports.removeLast=function(array){removeAt(array,array.length-1)};module.exports.insertAt=function(array,index,element){array.splice(index,0,element)};module.exports.series=function(from,to){var params=[from,to];if(from>to){params=[to,from]}var result=[];while(params[0]<=params[1]){result.push(params[0]++)}return from>to?result.reverse():result};module.exports.pretty=function(array,lastSeparator){if(objectUtils.isUndefined(lastSeparator)){lastSeparator="e"}return array.toString().replace(/,/g,", ").replace(/,\s([^,]+)$/," "+lastSeparator+" $1")};module.exports.clean=function(array,deleteValue){for(var i=0;i<array.length;i++){if(array[i]===deleteValue){array.splice(i,1);i--}}return array};module.exports.intersection=function(a,b){return b.filter(function(element){return a.indexOf(element)!==-1})};module.exports.toDictionary=function(array,key){var result={};array.forEach(function(element){result[element[key]]=element});return result};module.exports.chop=function(array,quantity){var result=[];var subArray=[];var count=0;array.forEach(function(element){if(count===quantity){result.push(subArray);subArray=[];count=0}subArray.push(element);count++});if(subArray.length>0){result.push(subArray)}return result}},{"./mathUtils":14,"./objectUtils":17,util:56}],4:[function(_dereq_,module,exports){"use strict";var validationUtils=_dereq_("./validationUtils");module.exports.__name="Barcode";module.exports.__description="Utilities for generating barcodes";function getBarcode128CCheckDigit(text){if(text.length%2!==0){throw new Error("Text must have an even number of characters")}if(!validationUtils.isNumericString(text)){throw new Error("Text must contain only numbers")}return text.match(/.{2}/g).reduce(function(acc,next,index){return acc+parseInt(next,10)*(index+1)},105)%103}function getBarcode128CAsciiString(text){var dictionary={"00":" ","01":"!","02":"'","03":"#","04":"$","05":"%","06":"&","07":"'","08":"(","09":")",10:"*",11:"+",12:",",13:"-",14:".",15:"/",16:"0",17:"1",18:"2",19:"3",20:"4",21:"5",22:"6",23:"7",24:"8",25:"9",26:":",27:";",28:"<",29:"=",30:">",31:"?",32:"@",33:"A",34:"B",35:"C",36:"D",37:"E",38:"F",39:"G",40:"H",41:"I",42:"J",43:"K",44:"L",45:"M",46:"N",47:"O",48:"P",49:"Q",50:"R",51:"S",52:"T",53:"U",54:"V",55:"W",56:"X",57:"Y",58:"Z",59:"[",60:"\\",61:"]",62:"^",63:"_",64:"`",65:"a",66:"b",67:"c",68:"d",69:"e",70:"f",71:"g",72:"h",73:"i",74:"j",75:"k",76:"l",77:"m",78:"n",79:"o",80:"p",81:"q",82:"r",83:"s",84:"t",85:"u",86:"v",87:"w",88:"x",89:"y",90:"z",91:"{",92:"|",93:"}",94:"~",95:"È",96:"É",97:"Ê",98:"Ë",99:"Ì"};return text.match(/.{2}/g).reduce(function(acc,next){return acc+dictionary[next]},"Ò")+"Ó"}module.exports.barcode128c=function(text){var checkDigit=getBarcode128CCheckDigit(text);return{checkDigit:checkDigit,asciiString:getBarcode128CAsciiString(text+checkDigit),originalString:text}}},{"./validationUtils":34}],5:[function(_dereq_,module,exports){"use strict";module.exports.__name="Boolean";module.exports.isTrue=function(value){return["on","true","yes",1,true].indexOf(value)>-1}},{}],6:[function(_dereq_,module,exports){(function(process){"use strict";module.exports.__name="Console";module.exports.clearScreen=function(){process.stdout.write("")}}).call(this,_dereq_("UPikzY"))},{UPikzY:54}],7:[function(_dereq_,module,exports){(function(__dirname){"use strict";module.exports.__name="Controller";module.exports.__description="Utilities for the express framework";var path=_dereq_("path");module.exports.acceptJson=function(req,res,next){req.headers.accept="application/json";res.lean=true;next()};module.exports.acceptXml=function(req,res,next){req.headers.accept="application/xml";res.lean=true;next()};module.exports.acceptCsv=function(req,res,next){req.headers.accept="text/csv";res.lean=true;next()};var corsDefaults={allowOrigin:"*",allowMethods:"GET,PUT,POST,DELETE,HEAD,OPTIONS",allowHeaders:"Content-Type, Authorization, Content-Length, X-Requested-With",exposeHeaders:""};module.exports.allowCORS=function(params){if(typeof params==="undefined"){params=corsDefaults}return function(req,res,next){res.header("Access-Control-Allow-Origin",params.allowOrigin||corsDefaults.allowOrigin);res.header("Access-Control-Allow-Methods",params.allowMethods||corsDefaults.allowMethods);res.header("Access-Control-Allow-Headers",params.allowHeaders||corsDefaults.allowHeaders);res.header("Access-Control-Expose-Headers",params.exposeHeaders||corsDefaults.exposeHeaders);if("OPTIONS"===req.method){return res.status(200).end()}next()}};module.exports.loadAction=function(name,options){return _dereq_(path.join(__dirname,"./actions/"+name+"Action"))(options)}}).call(this,"/lib")},{path:53}],8:[function(_dereq_,module,exports){"use strict";var crypto=_dereq_("crypto");module.exports.__name="Crypto";module.exports.hmac=function(algorithm,key,text,encoding){if(typeof encoding==="undefined"){encoding="base64"}var hmac=crypto.createHmac(algorithm,key);hmac.setEncoding(encoding);hmac.write(text);hmac.end();return hmac.read()};module.exports.sha1=function(value){return crypto.createHash("sha1").update(value).digest("hex")};module.exports.md5=function(value){return crypto.createHash("md5").update(value).digest("hex")};module.exports.cipher=function(value,password,algorithm){algorithm=algorithm||"aes256";var cipher=crypto.createCipher(algorithm,password);return cipher.update(value,"utf8","hex")+cipher.final("hex")};module.exports.decipher=function(value,password,algorithm){algorithm=algorithm||"aes256";var decipher=crypto.createDecipher(algorithm,password);return decipher.update(value,"hex","utf8")+decipher.final("utf8")}},{crypto:42}],9:[function(_dereq_,module,exports){"use strict";module.exports.__name="Date";module.exports.unixTime=function(date,onlyDate){if(typeof date==="undefined"){date=new Date}if(typeof onlyDate==="undefined"){onlyDate=false}if(onlyDate){return Date.UTC(date.getFullYear(),date.getMonth(),date.getDate())}else{return Date.UTC(date.getFullYear(),date.getMonth(),date.getDate(),date.getHours(),date.getMinutes(),date.getSeconds(),date.getMilliseconds())}}},{}],10:[function(_dereq_,module,exports){(function(process){"use strict";var objectUtils=_dereq_("./objectUtils"),NODE_ENV=process.env.NODE_ENV;module.exports.__name="Environment";module.exports.__description="Utilities for dealing with environment variables";function is(desired){if(!Array.isArray(desired)){desired=[desired]}return desired.indexOf(NODE_ENV)>-1||objectUtils.isUndefined(NODE_ENV)&&desired.indexOf("development")>-1}module.exports.is=is;module.exports.ifEnvIs=function(desired){desired=[desired];var that={};that.then=function(fn){if(is(desired)){fn()}return that};that.or=function(env){desired.push(env);return that};that.otherwise=function(fn){if(!is(desired)){fn()}return that};that.log=function(text){if(is(desired)){console.log(text)}return that};return that}}).call(this,_dereq_("UPikzY"))},{"./objectUtils":17,UPikzY:54}],11:[function(_dereq_,module,exports){var httpUtils=_dereq_("./httpUtils");module.exports.__name="Error";function HttpClientError(messageToClient,statusCode,data){Error.call(this);Error.captureStackTrace(this,arguments.callee);if(typeof statusCode==="undefined"){statusCode=400}else if(isNaN(parseInt(statusCode,10))){data=statusCode;statusCode=400}if(typeof statusCode!=="number"||statusCode<400||statusCode>=500){throw new Error("Status code should be a number between 400 and 499")}this.messageToClient=messageToClient||httpUtils.statuses[statusCode];this.statusCode=statusCode,this.data=data||{},this.message="Error caused by user behavior: "+(messageToClient||"no details given");this.name="HttpClientError"}HttpClientError.prototype.__proto__=Error.prototype;module.exports.HttpClientError=HttpClientError},{"./httpUtils":13}],12:[function(_dereq_,module,exports){"use strict";module.exports.__name="File System"},{}],13:[function(_dereq_,module,exports){"use strict";module.exports.__name="Http";module.exports.methods=["get","post","put","head","delete","options","trace","copy","lock","mkcol","move","propfind","proppatch","unlock","report","mkactivity","checkout","merge","m-search","notify","subscribe","unsubscribe","patch","search"];module.exports.statuses={"continue":100,100:"Continue",switchingProtocols:101,101:"Switching Protocols",success:200,200:"Success",created:201,201:"Created",accepted:202,202:"Accepted",nonAuthoritativeInformation:203,203:"Non-Authoritative Information",noContent:204,204:"No Content",resetContent:205,205:"Reset Content",partialContent:206,206:"Partial Content",multiStatus:207,207:"Multi-Status",multipleChoices:300,300:"Multiple Choices",movedPermanently:301,301:"Moved Permanently",found:302,302:"Found",seeOther:303,303:"See Other",notModified:304,304:"Not Modified",useProxy:305,305:"Use Proxy",unused:306,306:"Unused",temporaryRedirect:307,307:"Temporary Redirect",badRequest:400,400:"Bad Request",unauthorized:401,401:"Unauthorized",paymentRequired:402,402:"Payment Required",forbidden:403,403:"Forbidden",notFound:404,404:"Not Found",methodNotAllowed:405,405:"Method Not Allowed",notAcceptable:406,406:"Not Acceptable",proxyAuthenticationRequired:407,407:"Proxy Authentication Required",requestTimeout:408,408:"Request Timeout",conflict:409,409:"Conflict",gone:410,410:"Gone",lengthRequired:411,411:"Length Required",preconditionFailed:412,412:"Precondition Failed",requestEntityTooLarge:413,413:"Request Entity Too Large",requestURITooLong:414,414:"Request-URI Too Long",unsupportedMediaType:415,415:"Unsupported Media Type",requestedRangeNotSatisfiable:416,416:"Requested Range Not Satisfiable",expectationFailed:417,417:"Expectation Failed",internalServerError:500,500:"Internal Server Error",notImplemented:501,501:"Not Implemented",badGateway:502,502:"Bad Gateway",serviceUnavailable:503,503:"Service Unavailable",gatewayTimeout:504,504:"Gateway Timeout",httpVersionNotSupported:505,505:"HTTP Version Not Supported"}},{}],14:[function(_dereq_,module,exports){"use strict";var objectUtils=_dereq_("./objectUtils"),arrayUtils=_dereq_("./arrayUtils"),stringUtils=_dereq_("./stringUtils"),mathUtilsNonStrict=_dereq_("./mathUtilsNonStrict");module.exports.__name="Math";module.exports.smaller=function(a,b){return a<b?a:b};module.exports.bigger=function(a,b){return a>b?a:b};function MovingAverage(samplesToCount,fill,weighted,property){var acumulator=[],getFromProperty=typeof property!=="undefined";if(Array.isArray(weighted)&&weighted.length!==samplesToCount){return new Error("Array of weights have same length as samples to count")}function factor(index){if(weighted===true){return index+1}else if(Array.isArray(weighted)){return weighted[index]}else{return 1}}function average(){if(weighted===true){return(Math.pow(acumulator.length,2)+acumulator.length)/2}else if(Array.isArray(weighted)){return arrayUtils.sum(weighted.slice(0,acumulator.length))}else{return acumulator.length}}this.add=function(data){acumulator.push(parseInt(getFromProperty?data[property]:data,10));if(acumulator.length===samplesToCount||fill){var value=acumulator.reduce(function(previous,current,index){return previous+current*factor(index)},0)/average();if(acumulator.length===samplesToCount){acumulator.shift()}return value}else{return undefined}}}module.exports.MovingAverage=MovingAverage;function Minimum(property){var getFromProperty=typeof property!=="undefined";this.current=null;this.compare=function(data){data=parseInt(getFromProperty?data[property]:data,10);if(this.current===null||data<this.current){this.current=data}}}module.exports.Minimum=Minimum;function Maximum(property){var getFromProperty=typeof property!=="undefined";this.current=null;this.compare=function(data){data=parseInt(getFromProperty?data[property]:data,10);if(this.current===null||data>this.current){this.current=data}}}module.exports.Maximum=Maximum;var Average=function(property){var acumulator=[],getFromProperty=typeof property!=="undefined";this.add=function(data){this.length++;acumulator.push(parseInt(getFromProperty?data[property]:data,10));this.result=acumulator.reduce(function(a,b){return a+b})/acumulator.length};this.length=0;this.result=null};module.exports.Average=Average;module.exports.LinearRegression=function(propertyX,propertyY){if(typeof propertyX==="undefined"){propertyX="x"}if(typeof propertyY==="undefined"){propertyY="y"}var sumOfX=0,sumOfY=0,sumOfXY=0,sumOfXX=0,sumOfYY=0,divisor=1,lastX=null,nextIsAvailable=true,xAverage=new Average;this.length=0;this.add=function(sample){var x=parseInt(sample[propertyX],10),y=parseInt(sample[propertyY],10);this.length++;if(lastX){if(x<lastX){nextIsAvailable=false}xAverage.add(Math.abs(x-lastX))}lastX=x;sumOfX+=x;sumOfY+=y;sumOfXY+=x*y;sumOfXX+=x*x;sumOfYY+=y*y;divisor=this.length*sumOfXX-sumOfX*sumOfX};this.a=function(){return(sumOfXX*sumOfY-sumOfXY*sumOfX)/divisor};this.b=function(){return(this.length*sumOfXY-sumOfX*sumOfY)/divisor};this.correlation=function(){return(this.length*sumOfXY-sumOfX*sumOfY)/(Math.sqrt(this.length*sumOfXX-sumOfX*sumOfX)*Math.sqrt(this.length*sumOfYY-sumOfY*sumOfY))};this.calculate=function(x){return this.a()+this.b()*x};this.next=function(){if(!nextIsAvailable){return new Error('To use the the "next" function your must add samples in ascending order of X')}var nextX=lastX+xAverage.result;lastX=nextX;return{x:nextX,y:this.calculate(nextX)}}};module.exports.linearRegression=function(samples){var length=samples.length,sumOfX=0,sumOfY=0,sumOfXY=0,sumOfXX=0;samples.forEach(function(sample){sumOfX+=sample.x;sumOfY+=sample.y;sumOfXY+=sample.x*sample.y;sumOfXX+=sample.x*sample.x});var divisor=length*sumOfXX-sumOfX*sumOfX,a=(sumOfXX*sumOfY-sumOfXY*sumOfX)/divisor,b=(length*sumOfXY-sumOfX*sumOfY)/divisor;return{a:a,b:b,fn:function(x){return a+b*x}}};module.exports.bigSum=function(a,b){a=a.toString();b=b.toString();var biggest=a.length>b.length?a:b,smallest=a.length<=b.length?a:b,rest,result="";a=stringUtils.pad(smallest,biggest.length,"0").split("");b=biggest.split("");rest=b.reduceRight(function(rest,current,index){var aDigit=parseInt(a[index],10),bDigit=parseInt(b[index],10),sum=aDigit+bDigit+rest;result=(sum>9?sum-10:sum)+result;return sum>9?1:0},0);return rest===0?result:"1"+result};module.exports.median=function(array){return array.reduce(function(a,b){return a+b})/array.length};module.exports.pearsonCoefficient=function(a,b){var sumA=0,sumB=0,sumASquared=0,sumBSquared=0,sumAB=0,intersection=0,property;for(property in a){if(a.hasOwnProperty(property)&&b&&b.hasOwnProperty(property)){sumA+=a[property];sumB+=b[property];sumASquared+=Math.pow(a[property],2);sumBSquared+=Math.pow(b[property],2);sumAB+=a[property]*b[property];intersection++}}if(intersection===0){return 0}var num=sumAB-sumA*sumB/intersection;var den=Math.sqrt((sumASquared-Math.pow(sumA,2)/intersection)*(sumBSquared-Math.pow(sumB,2)/intersection));return den===0?0:num/den};module.exports.euclideanDistance=function(a,b){var sum=0,property;for(property in a){if(a.hasOwnProperty(property)&&b&&b.hasOwnProperty(property)){sum+=Math.pow(a[property]-b[property],2)}}return Math.sqrt(sum)};module.exports.solve=mathUtilsNonStrict.solve;module.exports.mod=function(value,factors,divider,direction){if(objectUtils.isUndefined(divider)){divider=11}if(objectUtils.isUndefined(factors)){factors=arrayUtils.series(2,9)}if(objectUtils.isUndefined(direction)){direction="rightToLeft"}var reduceMethod=direction==="leftToRight"?"reduce":"reduceRight";var i=0;return value.split("")[reduceMethod](function(last,current){if(i>factors.length-1){i=0}return factors[i++]*parseInt(current,10)+last},0)%divider};function convolve(signal1,signal2){var signal1Length=signal1.length,signal2Length=signal2.length,finalSize=signal1Length+signal2Length-1;var result=new Array(finalSize);for(var i=0;i<finalSize;i++){result[i]=0;for(var j=0;j<signal2Length;j++){if(i-j<0){continue}if(i-j>=signal1Length){continue}result[i]+=signal2[j]*signal1[i-j]}}return result}module.exports.convolve=convolve;module.exports.multiplyPolynomials=convolve;function getPrimeFactors(number){var factors=[],factor;function getPrimeFactor(number){for(var i=2;i<=Math.sqrt(number);i++){if(number%i===0){return i}}return number}while(factor=getPrimeFactor(number)){factors.push(factor);number/=factor;if(number===1){break}}return factors}module.exports.getPrimeFactors=getPrimeFactors;function isPrime(number){if(number===2){return true}else if(number%2===0){return false}return getPrimeFactors(number).length===1}module.exports.isPrime=isPrime},{"./arrayUtils":3,"./mathUtilsNonStrict":15,"./objectUtils":17,"./stringUtils":20}],15:[function(_dereq_,module,exports){module.exports.__name="Math";module.exports.solve=function(input,vars){try{return eval("with(Math){with(vars || {}){"+input+"}}")}catch(e){console.log(e);return NaN}}},{}],16:[function(_dereq_,module,exports){"use strict";var oUtils=_dereq_("./objectUtils");module.exports.__name="Number";module.exports.getRandomInteger=function(min,max){return Math.floor(Math.random()*(max-min+1))+min};module.exports.isBetween=function(value,min,max,inclusive){if(oUtils.isUndefined(inclusive)){inclusive=true}if(inclusive){return value>=min&&value<=max}else{return value>min&&value<max}}},{"./objectUtils":17}],17:[function(_dereq_,module,exports){"use strict";var util=_dereq_("util");module.exports.__name="Object";function isUndefined(object){return typeof object===typeof undefined}module.exports.isUndefined=isUndefined;function forEachOwnProperty(object,iterator){if(typeof object!=="object"||object===null){return}var propertiesLength=Object.keys(object).length,current=1; for(var property in object){if(object.hasOwnProperty(property)){if(iterator(property,object[property],current++<propertiesLength)==="break"){break}}}}module.exports.forEachOwnProperty=forEachOwnProperty;function merge(destination,source){if(isUndefined(destination)){destination={}}if(isUndefined(source)){source={}}forEachOwnProperty(source,function(property,value){destination[property]=value});return destination}module.exports.merge=merge;function flatten(object,join,root){if(!object||typeof object!=="object"){return object}if(typeof join==="string"){root=join;join=null}if(!join){join=function(a,b){if(!a){return b}return a+"."+b}}var result={};forEachOwnProperty(object,function(key,value){if(typeof value==="object"&&!util.isRegExp(value)&&!util.isDate(value)){return merge(result,flatten(value,join,join(root,key)))}else{result[join(root,key)]=value;return result}});return result}module.exports.flatten=flatten;function unflatten(object,separator){var result={};if(isUndefined(separator)){separator="."}function getContainer(property){if(/^\+?(0|[1-9]\d*)$/.test(property)){return[]}else{return{}}}forEachOwnProperty(object,function(property,messages){property=property.split(separator);var currentNode=result;for(var i=0;i<property.length;i++){var currentProperty=property[i];if(isUndefined(currentNode[currentProperty])){if(i===property.length-1){currentNode[currentProperty]=messages}else{currentNode[currentProperty]=getContainer(property[i+1])}}currentNode=currentNode[currentProperty]}});return result}module.exports.unflatten=unflatten;function deepSet(object,property,value){if(isUndefined(object)||object===null){return false}if(!Array.isArray(property)){property=property.split(".")}if(property.length>1){var currentProperty=property.shift();if(isUndefined(object[currentProperty])){if(/\d+/.test(property[0])){object[currentProperty]=[]}else{object[currentProperty]={}}}return deepSet(object[currentProperty],property,value)}else{object[property.shift()]=value;return true}}module.exports.deepSet=deepSet;function deepMerge(destination,source){if(isUndefined(destination)){destination={}}if(isUndefined(source)){source={}}forEachOwnProperty(flatten(source),function(key,value){deepSet(destination,key,value)});return destination}module.exports.deepMerge=deepMerge;function deepDelete(object,property){if(typeof object==="undefined"){return false}if(!Array.isArray(property)){property=property.split(".")}if(property.length>1){return deepDelete(object[property.shift()],property)}else{if(typeof object[property[0]!=="undefined"]){delete object[property[0]];return true}else{return false}}}module.exports.deepDelete=deepDelete;function resolveProperty(object,property,deep){if(typeof deep==="undefined"){deep=true}if(typeof property==="string"&&deep){property=property.split(".")}if(!object){return null}if(!deep){property=Array.isArray(property)?property[0]:property;if(typeof property==="undefined"){return object}else{return object[property]}}return resolveProperty(object[property.shift()],property,property.length>1)}module.exports.resolveProperty=resolveProperty;function isObject(object){return typeof object==="object"}module.exports.isObject=isObject;function isArray(object){return util.isArray(object)}module.exports.isArray=isArray;module.exports.values=function(object){var key,values=[];if(!isObject(object)||isArray(object)){throw new Error("Invalid parameter")}for(key in object){if(object.hasOwnProperty(key)){values.push(object[key])}}return values};module.exports.keys=function(object){var key,keys=[];if(!isObject(object)||isArray(object)){throw new Error("Invalid parameter")}for(key in object){if(object.hasOwnProperty(key)){keys.push(key)}}return keys};function prune(object,blacklist){if(isUndefined(object)||isUndefined(blacklist)){return object}if(typeof blacklist==="string"){blacklist=blacklist.split(",").map(function(key){return key.trim()})}var isArray=Array.isArray(object);if(!isArray){object=[object]}object=object.map(function(result){if(result===null||typeof result==="undefined"){return null}blacklist.forEach(function(propertyToRemove){delete result[propertyToRemove]});return result});if(isArray){return object}else{return object[0]}}module.exports.prune=prune;function pick(objects,whitelist){if(isUndefined(whitelist)){return{}}var isArray=Array.isArray(objects),blacklist=[];if(!isArray){objects=[objects]}objects.forEach(function(object){Object.keys(object).forEach(function(key){if(whitelist.indexOf(key)===-1&&blacklist.indexOf(key)===-1){blacklist.push(key)}})});objects=prune(objects,blacklist);if(isArray){return objects}else{return objects[0]}}module.exports.pick=pick;module.exports.isEmpty=function(object){if(typeof object!=="object"){return false}for(var prop in object){if(object.hasOwnProperty(prop)){return false}}return true};module.exports.isBoolean=function(object){return typeof object==="boolean"};module.exports.isString=function(object){return typeof object==="string"};module.exports.isNumber=function(object){return!isNaN(parseFloat(object))&&isFinite(object)};module.exports.argsToArray=function(args,startingFrom){if(isUndefined(startingFrom)){startingFrom=0}return Array.prototype.slice.call(args,startingFrom)}},{util:56}],18:[function(_dereq_,module,exports){"use strict";var mathUtils=_dereq_("./mathUtils");module.exports.__name="Recomendation";module.exports.similarityByEuclideanDistance=function(a,b){return 1/(1+mathUtils.euclideanDistance(a,b))};module.exports.similarityByPearsonCoefficient=function(a,b){return mathUtils.pearsonCoefficient(a,b)}},{"./mathUtils":14}],19:[function(_dereq_,module,exports){"use strict";module.exports.__name="RegExp";module.exports.escape=function(regExpString){var regexpSpecialChars=/([\[\]\^\$\|\(\)\\\+\*\?\{\}])/gi;return new RegExp(regExpString.replace(regexpSpecialChars,"\\$1"))}},{}],20:[function(_dereq_,module,exports){"use strict";var accentMap=_dereq_("./accentMap"),numberUtils=_dereq_("./numberUtils"),objectUtils=_dereq_("./objectUtils"),validationUtils=_dereq_("./validationUtils"),net=_dereq_("net");module.exports.__name="String";function reduceWhiteSpaces(string){if(typeof string!=="string"){return string}return string.replace(/[\s]{2,}/g," ").trim()}module.exports.reduceWhiteSpaces=reduceWhiteSpaces;function count(string,regexp){if(typeof regexp==="string"){regexp=new RegExp(regexp,"g")}return(string.match(regexp)||[]).length}module.exports.count=count;function capitalize(value){if(typeof value!=="string"){return value}return value.substr(0,1).toUpperCase()+value.substr(1)}module.exports.capitalize=capitalize;function decapitalize(value){if(typeof value!=="string"){return value}return value.substr(0,1).toLowerCase()+value.substr(1)}module.exports.decapitalize=decapitalize;function camelCaseJoin(a,b){if(!a){return b}return decapitalize(a)+capitalize(b)}module.exports.camelCaseJoin=camelCaseJoin;function Record(value){var _label="";this.labeled=function(label){_label=label};this.label=function(){return _label};this.toString=function(){return value}}function Line(maxSize,parsers){var _parsers={},records=[],currentSize=0;if(typeof maxSize==="object"){parsers=maxSize;maxSize=undefined}if(objectUtils.isUndefined(maxSize)){maxSize=Number.MAX_VALUE}if(objectUtils.isUndefined(parsers)){parsers={value:function(value){return value}}}objectUtils.forEachOwnProperty(parsers,function(name,fn){_parsers[name]=function(){var value=fn.apply(this,arguments);if(currentSize+value.length>maxSize){throw new Error("Size limit of "+maxSize+" exceeded")}currentSize+=value.length;var record=new Record(value);records.push(record);return record}});this.add=_parsers;this.toString=function(separator,exportLabels){if(objectUtils.isUndefined(exportLabels)){exportLabels=false}separator=separator||"";var labels="";if(exportLabels){labels=records.map(function(record){return record.label()}).join(separator)+"\n"}return labels+records.join(separator)}}module.exports.Line=Line;function truncate(string,length){if(string===null){return""}string=String(string);length=parseInt(length,10);return string.length>length?string.slice(0,length):string}module.exports.truncate=truncate;function parseFormattedEmailAddress(email){if(typeof email==="undefined"||typeof email!=="string"){return email}var data=email.match(validationUtils.validFormattedEmailAddressRegExp);if(data){return{name:data[1],email:data[2]}}else{return email}}module.exports.parseFormattedEmailAddress=parseFormattedEmailAddress;function generateGuid(separators){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(c){var r=Math.random()*16|0,v=c=="x"?r:r&3|8;return v.toString(16)})}module.exports.generateGuid=generateGuid;function pad(str,length,padStr,type){str=str==null?"":String(str);length=~~length;var padlen=0;if(!padStr)padStr=" ";else if(padStr.length>1)padStr=padStr.charAt(0);switch(type){case"right":padlen=length-str.length;return str+strRepeat(padStr,padlen);case"both":padlen=length-str.length;return strRepeat(padStr,Math.ceil(padlen/2))+str+strRepeat(padStr,Math.floor(padlen/2));default:padlen=length-str.length;return strRepeat(padStr,padlen)+str}function strRepeat(str,qty){if(qty<1)return"";var result="";while(qty>0){if(qty&1)result+=str;qty>>=1,str+=str}return result}}module.exports.pad=pad;function removeDiacritics(string){if(!string){return""}var result="";for(var i=0;i<string.length;i++){result+=accentMap[string.charAt(i)]||string.charAt(i)}return result}module.exports.removeDiacritics=removeDiacritics;function dasherize(string){if(typeof string==="undefined"||string===null){return""}return string.toString().trim(string).replace(/([A-Z])/g,"-$1").replace(/[-_\s]+/g,"-").toLowerCase()}module.exports.dasherize=dasherize;function slugify(string){if(typeof string==="undefined"||string===null){return""}var slug=removeDiacritics(string).replace(/[^\w\s-]/g,"").toLowerCase();return dasherize(slug)}module.exports.slugify=slugify;function getSearchString(string){return removeDiacritics(string).toLowerCase().replace(/[^\w]/g,"")}module.exports.getSearchString=getSearchString;function reverseString(string){return string.split("").reverse().join("")}module.exports.reverseString=reverseString;function findPrefix(strings){if(strings&&strings.length>0){var prefix="";var characters=strings[0].split("");for(var i=0;i<characters.length;i++){var isPrefix=true;var character=characters[i];for(var j=0;j<strings.length;j++){var string=strings[j];isPrefix=isPrefix&&(string.length>=i+1&&string[i]===character)}if(isPrefix){prefix+=character}else{return prefix}}}else{return null}}module.exports.findPrefix=findPrefix;function findSuffix(strings){var reversed=[];strings.forEach(function(string){reversed.push(reverseString(string))});return reverseString(findPrefix(reversed))}module.exports.findSuffix=findSuffix;function removePrefix(strings){var prefix=findPrefix(strings);var result=[];strings.forEach(function(string){result.push(string.replace(prefix,""))});return result}module.exports.removePrefix=removePrefix;function startsWith(str,starts){if(starts===""){return true}if(str===null||starts===null){return false}str=String(str);starts=String(starts);return str.length>=starts.length&&str.slice(0,starts.length)===starts}module.exports.startsWith=startsWith;function endsWith(str,ends){if(ends===""){return true}if(str===null||ends===null){return false}str=String(str);ends=String(ends);return str.length>=ends.length&&str.slice(str.length-ends.length)===ends}module.exports.endsWith=endsWith;function joinUrls(a,b){if(a===""){return b}else if(b===""){return a}else if(endsWith(a,"/")&&startsWith(b,"/")){return a+b.substr(1)}else if(endsWith(a,"/")&&!startsWith(b,"/")){return a+b}else if(!endsWith(a,"/")&&startsWith(b,"/")){return a+b}else if(!endsWith(a,"/")&&!startsWith(b,"/")){return a+"/"+b}}module.exports.joinUrls=joinUrls;function getUrlSubpaths(path){var result=[];path=path.split("/").filter(function(segment){return segment!==""});path.forEach(function(segment,index){if(index===0){result.push(segment)}else{result.push(joinUrls(result[index-1],segment))}});return result}module.exports.getUrlSubpaths=getUrlSubpaths;function nextSizeType(type){if(type==="b"){return"Kb"}else if(type==="Kb"){return"Mb"}else if(type==="Mb"){return"Gb"}else if(type==="Gb"){return"Tb"}else if(type==="Tb"||type==="Pb"){return"Pb"}else{return null}}module.exports.nextSizeType=nextSizeType;function formatFileSize(size,type,precision,decimalSeparator){if(typeof precision==="undefined"){precision=2}if(typeof type==="undefined"){type="b"}if(typeof decimalSeparator==="undefined"){decimalSeparator="."}if(size<1024||type==="Pb"){return size.toFixed(precision).replace(".",decimalSeparator)+type}else{return formatFileSize(size/1024,nextSizeType(type),precision,decimalSeparator)}}module.exports.formatFileSize=formatFileSize;module.exports.parseSequence=function(string,sequenceDescriptor){var start=0,property;for(property in sequenceDescriptor){if(sequenceDescriptor.hasOwnProperty(property)){var length=parseInt(sequenceDescriptor[property],10);sequenceDescriptor[property]=string.substr(start,length);start+=length}}return sequenceDescriptor};module.exports.onlyLettersAndNumbers=function(string,size){if(typeof size==="undefined"){size="+"}if(["+","*"].indexOf(size)===-1){size="{"+size+"}"}return new RegExp("^[0-9a-zA-Z]"+size+"$").test(string)};module.exports.getLink=function(text,options){var link=text.link(options.href);if(options.title){link=link.replace("href=",'title="'+options.title+'" href=')}if(options.target){link=link.replace("href=",'target="'+options.target+'" href=')}return link};module.exports.getRandomString=function(length,chars){var result="";if(typeof chars==="undefined"){chars="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890!@#$%ˆ&*()-=+"}while(length>0){result+=chars[numberUtils.getRandomInteger(0,chars.length-1)];length--}return result};module.exports.isIp=function(value){var isIp=net.isIP(value);return isIp||false};module.exports.shortenName=function(name,level){if(name===""){return""}if(typeof level==="undefined"){level=0}if(level===2){var parts=name.split(" "),first=parts[0],last=parts.pop().trim();if(first===""){return""}while(typeof last!=="undefined"&&last.length<=3){last=parts.pop()}if(last===first||last===""||typeof last==="undefined"||last.length<=3){return first.substr(0,1)+"."}else{return first+" "+last.substr(0,1)+"."}}if(level===3){return name.split(" ").map(function(part,index){return part.length>3||index===0?part.substr(0,1).toUpperCase():""}).join("")}if(level===4){return name.substr(0,1).toUpperCase()+"."}var array=name.split(" ");return array.map(function(part,i){if(i===0||i===array.length-1||part.length<=3&&level===0){return part}else if(level===0){return part.substring(0,1).toUpperCase()+"."}else{return""}}).join(" ").replace(/\s{2,}/g," ")};module.exports.splitWords=function(text){return text.split(" ").filter(function(word){return word.length>0})}},{"./accentMap":2,"./numberUtils":16,"./objectUtils":17,"./validationUtils":34,net:35}],21:[function(_dereq_,module,exports){"use strict";var africa=_dereq_("./timezones/africa.json").Africa,america=_dereq_("./timezones/america.json").America,antarctica=_dereq_("./timezones/antarctica.json").Antarctica,artic=_dereq_("./timezones/artic.json").Artic,asia=_dereq_("./timezones/asia.json").Asia,atlantic=_dereq_("./timezones/atlantic.json").Atlantic,australia=_dereq_("./timezones/australia.json").Australia,europe=_dereq_("./timezones/europe.json").Europe,generic=_dereq_("./timezones/generic.json").Generic,indian=_dereq_("./timezones/indian.json").Indian,pacific=_dereq_("./timezones/pacific.json").Pacific;module.exports.__name="Timezone";module.exports.africa=africa;module.exports.america=america;module.exports.antarctica=antarctica;module.exports.artic=artic;module.exports.asia=asia;module.exports.atlantic=atlantic;module.exports.australia=australia;module.exports.europe=europe;module.exports.generic=generic;module.exports.indian=indian;module.exports.pacific=pacific;module.exports.all={africa:africa,america:america,antarctica:antarctica,artic:artic,asia:asia,atlantic:atlantic,australia:australia,europe:europe,generic:generic,indian:indian,pacific:pacific}},{"./timezones/africa.json":22,"./timezones/america.json":23,"./timezones/antarctica.json":24,"./timezones/artic.json":25,"./timezones/asia.json":26,"./timezones/atlantic.json":27,"./timezones/australia.json":28,"./timezones/europe.json":29,"./timezones/generic.json":30,"./timezones/indian.json":31,"./timezones/pacific.json":32}],22:[function(_dereq_,module,exports){module.exports={Africa:["Africa/Abidjan","Africa/Accra","Africa/Addis_Ababa","Africa/Algiers","Africa/Asmara","Africa/Bamako","Africa/Bangui","Africa/Banjul","Africa/Bissau","Africa/Blantyre","Africa/Brazzaville","Africa/Bujumbura","Africa/Cairo","Africa/Casablanca","Africa/Ceuta","Africa/Conakry","Africa/Dakar","Africa/Dar_es_Salaam","Africa/Djibouti","Africa/Douala","Africa/El_Aaiun","Africa/Freetown","Africa/Gaborone","Africa/Harare","Africa/Johannesburg","Africa/Juba","Africa/Kampala","Africa/Khartoum","Africa/Kigali","Africa/Kinshasa","Africa/Lagos","Africa/Libreville","Africa/Lome","Africa/Luanda","Africa/Lubumbashi","Africa/Lusaka","Africa/Malabo","Africa/Maputo","Africa/Maseru","Africa/Mbabane","Africa/Mogadishu","Africa/Monrovia","Africa/Nairobi","Africa/Ndjamena","Africa/Niamey","Africa/Nouakchott","Africa/Ouagadougou","Africa/Porto-Novo","Africa/Sao_Tome","Africa/Tripoli","Africa/Tunis","Africa/Windhoek"]}},{}],23:[function(_dereq_,module,exports){module.exports={America:["America/Adak","America/Anchorage","America/Anguilla","America/Antigua","America/Araguaina","America/Argentina/Buenos_Aires","America/Argentina/Catamarca","America/Argentina/Cordoba","America/Argentina/Jujuy","America/Argentina/La_Rioja","America/Argentina/Mendoza","America/Argentina/Rio_Gallegos","America/Argentina/Salta","America/Argentina/San_Juan","America/Argentina/San_Luis","America/Argen