@arthurferreira-dev/simples.js
Version:
Uma biblioteca simples para adicionar funcionalidades
2 lines (1 loc) • 5.9 kB
JavaScript
import e from"validator";function r(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function n(e,r){for(var n=0;n<r.length;n++){var t=r[n];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(e,o(t.key),t)}}function t(e,r,t){return r&&n(e.prototype,r),t&&n(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function o(e){var r=function(e,r){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var t=n.call(e,r||"default");if("object"!=typeof t)return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(e)}(e,"string");return"symbol"==typeof r?r:r+""}function u(e){return u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},u(e)}e.isEmail,e.isMobilePhone;var a=function(){return t(function e(){r(this,e)},[{key:"sum",value:function(e,r){return e+r}},{key:"sub",value:function(e,r){return e-r}},{key:"mult",value:function(e,r){return e*r}},{key:"div",value:function(e,r){return 0===r?1/0:e/r}},{key:"sqrt",value:function(e){return Math.sqrt(e)}},{key:"squared",value:function(e){return e*e}},{key:"log",value:function(e){return Math.log(e)}},{key:"log10",value:function(e){return Math.log10(e)}},{key:"round",value:function(e){return Math.round(e)}},{key:"power",value:function(e,r){return Math.pow(e,r)}},{key:"random",value:function(e,r){return Math.random()*(r-e)+e}},{key:"randomInt",value:function(e,r){return Math.floor(Math.random()*(r-e+1))+e}},{key:"pow10",value:function(e){return Math.pow(10,e)}},{key:"mod",value:function(e,r){return e%r}},{key:"factorial",value:function(e){if(e<0)return"Sorry, but the number is not positive. Desculpe mais o número não é positivo. Lo sentimos, pero el número no es positivo.";for(var r=1,n=1;n<=e;n++)r*=n;return r}},{key:"abs",value:function(e){return Math.abs(e)}},{key:"pi",value:function(e){return Math.PI}}])}(),i=function(){return t(function e(){r(this,e)},[{key:"isNumber",value:function(e){return"number"==typeof e&&!isNaN(e)}},{key:"isString",value:function(e){return"string"==typeof e}},{key:"isArray",value:function(e){return Array.isArray(e)}},{key:"isObject",value:function(e){return"object"===u(e)&&null!==e&&!Array.isArray(e)}},{key:"formatadorDate",value:function(e){var r=new Date(e),n=String(r.getDate()+1).padStart(2,"0"),t=String(r.getMonth()+1).padStart(2,"0"),o=r.getFullYear();return"".concat(n,"/").concat(t,"/").concat(o)}},{key:"formatDate",value:function(e){var r=new Date(e),n=String(r.getDate()+1).padStart(2,"0"),t=String(r.getMonth()+1).padStart(2,"0"),o=r.getFullYear();return"".concat(t,"/").concat(n,"/").concat(o)}},{key:"reverseString",value:function(e){return e.split("").reverse().join("")}},{key:"isEmail",value:function(r){return e.isEmail(r)}},{key:"isTelephone",value:function(r,n){return e.isMobilePhone(r,n)}},{key:"Console",value:function(e){return console.log(e)}}])}(),c=function(){return t(function e(){r(this,e)},[{key:"creatorElement",value:function(e){var r=document.createElement(e);return document.body.appendChild(r),r}},{key:"childElement",value:function(e,r){e.appendChild(r)}},{key:"textElement",value:function(e,r){e.textContent=r}}])}(),l=function(){return t(function e(){r(this,e)},[{key:"cafe",value:function(e){var r=1e3*e;return setTimeout(function(){console.log("Pausa pra tomar um Café ☕.","Já se passou ".concat(r/1e3," segundos"))},r)}},{key:"real",value:function(e){return new Intl.NumberFormat("pt-BR",{style:"currency",currency:"BRL"}).format(e)}},{key:"AbreOolho",value:function(){return console.log("Simples.js:","Abre o Olho, Animal!")}},{key:"doc",value:function(e){if("string"==typeof e){return console.log("Simples.js:","https://github.com/arthurferreira-dev/Simples.js")}return console.log("Error: digite como uma STRING!")}},{key:"sinal",value:function(){return alert("Simples JS: Tá ai seu Sinal!")}},{key:"dolar",value:function(e){return new Intl.NumberFormat("pt-BR",{style:"currency",currency:"USD",currencyDisplay:"narrowSymbol"}).format(e).replace("$","US$")}},{key:"euro",value:function(e){return new Intl.NumberFormat("pt-BR",{style:"currency",currency:"EUR"}).format(e)}},{key:"independencia",value:function(e){return"string"==typeof e?"07 de Setembro de 1822":"Error: digite como uma STRING!"}}])}(),f=function(){return t(function e(){r(this,e)},[{key:"dollar",value:function(e){return new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",currencyDisplay:"narrowSymbol"}).format(e)}},{key:"real",value:function(e){return new Intl.NumberFormat("en-US",{style:"currency",currency:"BRL"}).format(e)}},{key:"euro",value:function(e){return new Intl.NumberFormat("en-US",{style:"currency",currency:"EUR"}).format(e)}},{key:"pause",value:function(e){return setTimeout(function(){console.log("Pause Now!")},1e3*e)}},{key:"doc",value:function(e){if("string"==typeof e){return console.log("Simples.js:","https://github.com/arthurferreira-dev/Simples.js")}return console.log("Error: please write like a STRING!")}}])}(),y=function(){return t(function e(){r(this,e)},[{key:"euro",value:function(e){return new Intl.NumberFormat("es-ES",{style:"currency",currency:"EUR"}).format(e)}},{key:"dolar",value:function(e){return new Intl.NumberFormat("es-ES",{style:"currency",currency:"USD"}).format(e)}},{key:"real",value:function(e){return new Intl.NumberFormat("es-ES",{style:"currency",currency:"BRL"}).format(e)}},{key:"doc",value:function(e){if("string"==typeof e){return console.log("Simples.js:","https://github.com/arthurferreira-dev/Simples.js")}return console.log("Error: Porfavor escribe cómo una STRING!")}}])}();export{l as simplesBrasil,c as simplesElement,y as simplesEspana,a as simplesMath,f as simplesUSA,i as simplesUtils};