paliari-js-utils
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -1,1 +0,1 @@ | ||
module.exports=function(t){var n={};function r(e){if(n[e])return n[e].exports;var o=n[e]={i:e,l:!1,exports:{}};return t[e].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=t,r.c=n,r.d=function(t,n,e){r.o(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:e})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,n){if(1&n&&(t=r(t)),8&n)return t;if(4&n&&"object"==typeof t&&t&&t.__esModule)return t;var e=Object.create(null);if(r.r(e),Object.defineProperty(e,"default",{enumerable:!0,value:t}),2&n&&"string"!=typeof t)for(var o in t)r.d(e,o,function(n){return t[n]}.bind(null,o));return e},r.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(n,"a",n),n},r.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},r.p="/",r(r.s=1)}([function(t,n,r){"use strict";r.r(n);var e=function(t,n){var r=!0,e=!1,o=void 0;try{for(var i,u=String(n).split(".")[Symbol.iterator]();!(r=(i=u.next()).done);r=!0){var a=i.value;if(!t)return t;t=t[a]}}catch(t){e=!0,o=t}finally{try{r||null==u.return||u.return()}finally{if(e)throw o}}return t};function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var i=function(t){return null!==t&&"object"===o(t)},u={"à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","ç":"c","è":"e","é":"e","ê":"e","ë":"e","ì":"i","í":"i","î":"i","ï":"i","ñ":"n","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ő":"o","ù":"u","ú":"u","û":"u","ü":"u","ű":"u","ý":"y","ÿ":"y"},a=function(t){return t.toLocaleLowerCase().replace(/[^a-z0-9\s_-]/g,function(t){return u[t]||t})},c=function(t){return"[object Date]"===Object.prototype.toString.call(t)},f=function(t){return"[object RegExp]"===Object.prototype.toString.call(t)},l=function(t){return t?t.charAt(0).toUpperCase()+t.substr(1):t},d=function(t){return i(t)?function t(n){if(c(n))return new Date(n);if(f(n))return n;var r=Array.isArray(n)?[]:{};for(var e in n)r[e]=i(n[e])?t(n[e]):n[e];return r}(t):t};function s(t,n,r){return n in t?Object.defineProperty(t,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[n]=r,t}var p=function t(n){for(var r=arguments.length,e=new Array(r>1?r-1:0),o=1;o<r;o++)e[o-1]=arguments[o];if(!e.length)return n;var u=e.shift();if(i(n)&&i(u))for(var a in u)i(u[a])?(n[a]||Object.assign(n,s({},a,{})),t(n[a],u[a])):Object.assign(n,s({},a,u[a]));return t.apply(void 0,[n].concat(e))},v=function(t){return function t(n){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"/",e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[];return Object.getOwnPropertyNames(n).reduce(function(e,u){return o.push(u),i(n[u])?t(n[u],r,e,o):e[o.join(r)]=n[u],o.pop(),e},e)}(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:"/")},y="aiCOVlB8Ws3ZSMyJ64dwtqAI5TDG1ejgcFH2YfXErxbRKhzo90pvUPNnL7umkQ",h={};y.split("").sort().forEach(function(t,n){h[y.charAt(n)]=t});var g=function(t){if(!t)return t;var n="";return t.split("").forEach(function(t){n+=h[t]||t}),n},b=[100,200,500,750],m=function(t){return b.find(function(n){if(t<=n)return n})},w=function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=0,e=0;for(k in t)e+=Number(k)*t[k],r+=t[k];var o=Math.pow(10,n);return r?Math.round(e/r*o)/o:0},_=function(t){return t.replace(/-/g,"_").replace(/\//g,".").toLocaleLowerCase()},j=function(t,n){return"".concat(a(t),"_").concat(a(n)).replace(/ /g,"_")},O=function(t){return j(function(t){var n=!0,r=!1,e=void 0;try{for(var o,i=t[Symbol.iterator]();!(n=(o=i.next()).done);n=!0){var u=o.value;if(u.types.indexOf("administrative_area_level_1")>-1)return u.short_name}}catch(t){r=!0,e=t}finally{try{n||null==i.return||i.return()}finally{if(r)throw e}}}(t),function(t){var n=!0,r=!1,e=void 0;try{for(var o,i=t[Symbol.iterator]();!(n=(o=i.next()).done);n=!0){var u=o.value;if(u.types.indexOf("administrative_area_level_2")>-1)return u.long_name}}catch(t){r=!0,e=t}finally{try{n||null==i.return||i.return()}finally{if(r)throw e}}}(t))},x=function(t){if(!t.address_components)throw{code:"convert_place_no_address_componentes"};var n={};return n.geometry={viewport:{northeast:{lat:t.geometry.viewport.f.f,lng:t.geometry.viewport.b.f},southwest:{lat:t.geometry.viewport.f.b,lng:t.geometry.viewport.b.b}},location:{lat:t.geometry.location.lat(),lng:t.geometry.location.lng()}},n.formatted_address=t.formatted_address,n.place_id=t.place_id,n.cidade_id=O(t.address_components),n},S=function(){return function(t){return"desc"===t?9999999999999-Date.now():Date.now()}(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"desc").toString()+Math.random().toString().substr(2,7)},A="zyxwvutsrqponmlkjihgfedcba_ZYXWVUTSRQPONMLKJIHGFEDCBA9876543210-",E=0,M=[],L=function(){var t=Date.now(),n=t===E;E=t;for(var r=new Array(8),e=7;e>=0;e--)r[e]=A.charAt(t%64),t=Math.floor(t/64);if(0!==t)throw new Error("We should have converted the entire timestamp.");var o=r.join("");if(n){for(e=11;e>=0&&63===M[e];e--)M[e]=0;M[e]++}else for(e=0;e<12;e++)M[e]=Math.floor(64*Math.random());for(e=0;e<12;e++)o+=A.charAt(M[e]);if(20!=o.length)throw new Error("Length should be 20.");return o},C=function(t){for(var n=0,r=0;r<8;r++){var e=A.indexOf(t.charAt(r));if(-1===e)throw new Error("Invalid id!");n=64*n+e}return n},P=function t(n,r){var e=n.split(""),o=e.pop(),i=r[r.indexOf(o)+1];return i?e.join("")+i:t(e.join(""),r)+r[0]},D=function(t){return P(t,A.split(""))},R=function(t){return P(t,A.split("").sort())};var T=function t(n){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};for(var e in function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}(this,t),n)"function"==typeof n[e]?this[e]=null===r[e]?null:n[e](r[e]):this[e]=r[e]||n[e]};function I(t,n){for(var r=0;r<n.length;r++){var e=n[r];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(t,e.key,e)}}var N="pt_br",G=function(){function t(n){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:N;!function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}(this,t),this.locales=n,this.locale=r}return function(t,n,r){n&&I(t.prototype,n),r&&I(t,r)}(t,[{key:"t",value:function(t,n){return function(t,n){if(!t||!n)return t;for(var r in n)t=t.replace(new RegExp("%{"+r+"}","g"),n[r]);return t}((void 0)(this.current,t),n)}},{key:"setLocale",value:function(t){if(this.getAvailableLocales().includes(t))return this.locale=t,this;throw new Error("Locale not found!")}},{key:"getLocale",value:function(){return this.locale}},{key:"getAvailableLocales",value:function(){return Object.keys(this.locales)}},{key:"current",get:function(){return this.locales[this.locale]}}]),t}();r.d(n,"deepKey",function(){return e}),r.d(n,"isObject",function(){return i}),r.d(n,"transliterate",function(){return a}),r.d(n,"isDate",function(){return c}),r.d(n,"isRegExp",function(){return f}),r.d(n,"ucfirst",function(){return l}),r.d(n,"deepClone",function(){return d}),r.d(n,"deepMerge",function(){return p}),r.d(n,"flattenObject",function(){return v}),r.d(n,"jsEncode",function(){return g}),r.d(n,"thumbRange",function(){return m}),r.d(n,"starRating",function(){return w}),r.d(n,"prepareKey",function(){return _}),r.d(n,"convertPlace",function(){return x}),r.d(n,"idCidade",function(){return j}),r.d(n,"idCidadeAddressComponent",function(){return O}),r.d(n,"idGeneratorDesc",function(){return L}),r.d(n,"idGeneratorNumeric",function(){return S}),r.d(n,"idDescTimestamp",function(){return C}),r.d(n,"prevId",function(){return D}),r.d(n,"nextId",function(){return R}),r.d(n,"BaseModel",function(){return T}),r.d(n,"I18n",function(){return G})},function(t,n,r){t.exports=r(0)}]); | ||
module.exports=function(t){var n={};function r(e){if(n[e])return n[e].exports;var o=n[e]={i:e,l:!1,exports:{}};return t[e].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=t,r.c=n,r.d=function(t,n,e){r.o(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:e})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,n){if(1&n&&(t=r(t)),8&n)return t;if(4&n&&"object"==typeof t&&t&&t.__esModule)return t;var e=Object.create(null);if(r.r(e),Object.defineProperty(e,"default",{enumerable:!0,value:t}),2&n&&"string"!=typeof t)for(var o in t)r.d(e,o,function(n){return t[n]}.bind(null,o));return e},r.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(n,"a",n),n},r.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},r.p="/",r(r.s=1)}([function(t,n,r){"use strict";r.r(n);var e=function(t,n){var r=!0,e=!1,o=void 0;try{for(var i,u=String(n).split(".")[Symbol.iterator]();!(r=(i=u.next()).done);r=!0){var a=i.value;if(!t)return t;t=t[a]}}catch(t){e=!0,o=t}finally{try{r||null==u.return||u.return()}finally{if(e)throw o}}return t};function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var i=function(t){return null!==t&&"object"===o(t)},u=function(t){return"[object Object]"===Object.prototype.toString.call(arg)},a={"à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","ç":"c","è":"e","é":"e","ê":"e","ë":"e","ì":"i","í":"i","î":"i","ï":"i","ñ":"n","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ő":"o","ù":"u","ú":"u","û":"u","ü":"u","ű":"u","ý":"y","ÿ":"y"},c=function(t){return t.toLocaleLowerCase().replace(/[^a-z0-9\s_-]/g,function(t){return a[t]||t})},f=function(t){return"[object Date]"===Object.prototype.toString.call(t)},l=function(t){return"[object RegExp]"===Object.prototype.toString.call(t)},d=function(t){return t?t.charAt(0).toUpperCase()+t.substr(1):t},s=function(t){return i(t)?function t(n){if(f(n))return new Date(n);if(l(n))return n;var r=Array.isArray(n)?[]:{};for(var e in n)r[e]=i(n[e])?t(n[e]):n[e];return r}(t):t};function p(t,n,r){return n in t?Object.defineProperty(t,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[n]=r,t}var v=function t(n){for(var r=arguments.length,e=new Array(r>1?r-1:0),o=1;o<r;o++)e[o-1]=arguments[o];if(!e.length)return n;var u=e.shift();if(i(n)&&i(u))for(var a in u)i(u[a])?(n[a]||Object.assign(n,p({},a,{})),t(n[a],u[a])):Object.assign(n,p({},a,u[a]));return t.apply(void 0,[n].concat(e))},y=function(t){return function t(n){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"/",e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[];return Object.getOwnPropertyNames(n).reduce(function(e,u){return o.push(u),i(n[u])?t(n[u],r,e,o):e[o.join(r)]=n[u],o.pop(),e},e)}(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:"/")},h="aiCOVlB8Ws3ZSMyJ64dwtqAI5TDG1ejgcFH2YfXErxbRKhzo90pvUPNnL7umkQ",b={};h.split("").sort().forEach(function(t,n){b[h.charAt(n)]=t});var g=function(t){if(!t)return t;var n="";return t.split("").forEach(function(t){n+=b[t]||t}),n},m=[100,200,500,750],w=function(t){return m.find(function(n){if(t<=n)return n})},_=function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=0,e=0;for(k in t)e+=Number(k)*t[k],r+=t[k];var o=Math.pow(10,n);return r?Math.round(e/r*o)/o:0},j=function(t){return t.replace(/-/g,"_").replace(/\//g,".").toLocaleLowerCase()},O=function(t,n){return"".concat(c(t),"_").concat(c(n)).replace(/ /g,"_")},S=function(t){return O(function(t){var n=!0,r=!1,e=void 0;try{for(var o,i=t[Symbol.iterator]();!(n=(o=i.next()).done);n=!0){var u=o.value;if(u.types.indexOf("administrative_area_level_1")>-1)return u.short_name}}catch(t){r=!0,e=t}finally{try{n||null==i.return||i.return()}finally{if(r)throw e}}}(t),function(t){var n=!0,r=!1,e=void 0;try{for(var o,i=t[Symbol.iterator]();!(n=(o=i.next()).done);n=!0){var u=o.value;if(u.types.indexOf("administrative_area_level_2")>-1)return u.long_name}}catch(t){r=!0,e=t}finally{try{n||null==i.return||i.return()}finally{if(r)throw e}}}(t))},x=function(t){if(!t.address_components)throw{code:"convert_place_no_address_componentes"};var n={};return n.geometry={viewport:{northeast:{lat:t.geometry.viewport.f.f,lng:t.geometry.viewport.b.f},southwest:{lat:t.geometry.viewport.f.b,lng:t.geometry.viewport.b.b}},location:{lat:t.geometry.location.lat(),lng:t.geometry.location.lng()}},n.formatted_address=t.formatted_address,n.place_id=t.place_id,n.cidade_id=S(t.address_components),n},A=function(){return function(t){return"desc"===t?9999999999999-Date.now():Date.now()}(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"desc").toString()+Math.random().toString().substr(2,7)},E="zyxwvutsrqponmlkjihgfedcba_ZYXWVUTSRQPONMLKJIHGFEDCBA9876543210-",M=0,L=[],C=function(){var t=Date.now(),n=t===M;M=t;for(var r=new Array(8),e=7;e>=0;e--)r[e]=E.charAt(t%64),t=Math.floor(t/64);if(0!==t)throw new Error("We should have converted the entire timestamp.");var o=r.join("");if(n){for(e=11;e>=0&&63===L[e];e--)L[e]=0;L[e]++}else for(e=0;e<12;e++)L[e]=Math.floor(64*Math.random());for(e=0;e<12;e++)o+=E.charAt(L[e]);if(20!=o.length)throw new Error("Length should be 20.");return o},P=function(t){for(var n=0,r=0;r<8;r++){var e=E.indexOf(t.charAt(r));if(-1===e)throw new Error("Invalid id!");n=64*n+e}return n},D=function t(n,r){var e=n.split(""),o=e.pop(),i=r[r.indexOf(o)+1];return i?e.join("")+i:t(e.join(""),r)+r[0]},R=function(t){return D(t,E.split(""))},T=function(t){return D(t,E.split("").sort())};var I=function t(n){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};for(var e in function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}(this,t),n)"function"==typeof n[e]?this[e]=null===r[e]?null:n[e](r[e]):this[e]=r[e]||n[e]};function N(t,n){for(var r=0;r<n.length;r++){var e=n[r];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(t,e.key,e)}}var G="pt_br",K=function(){function t(n){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:G;!function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}(this,t),this.locales=n,this.locale=r}return function(t,n,r){n&&N(t.prototype,n),r&&N(t,r)}(t,[{key:"t",value:function(t,n){return function(t,n){if(!t||!n)return t;for(var r in n)t=t.replace(new RegExp("%{"+r+"}","g"),n[r]);return t}(e(this.current,t),n)}},{key:"setLocale",value:function(t){if(this.getAvailableLocales().includes(t))return this.locale=t,this;throw new Error("Locale not found!")}},{key:"getLocale",value:function(){return this.locale}},{key:"getAvailableLocales",value:function(){return Object.keys(this.locales)}},{key:"current",get:function(){return this.locales[this.locale]}}]),t}();r.d(n,"deepKey",function(){return e}),r.d(n,"isObject",function(){return i}),r.d(n,"isHash",function(){return u}),r.d(n,"transliterate",function(){return c}),r.d(n,"isDate",function(){return f}),r.d(n,"isRegExp",function(){return l}),r.d(n,"ucfirst",function(){return d}),r.d(n,"deepClone",function(){return s}),r.d(n,"deepMerge",function(){return v}),r.d(n,"flattenObject",function(){return y}),r.d(n,"jsEncode",function(){return g}),r.d(n,"thumbRange",function(){return w}),r.d(n,"starRating",function(){return _}),r.d(n,"prepareKey",function(){return j}),r.d(n,"convertPlace",function(){return x}),r.d(n,"idCidade",function(){return O}),r.d(n,"idCidadeAddressComponent",function(){return S}),r.d(n,"idGeneratorDesc",function(){return C}),r.d(n,"idGeneratorNumeric",function(){return A}),r.d(n,"idDescTimestamp",function(){return P}),r.d(n,"prevId",function(){return R}),r.d(n,"nextId",function(){return T}),r.d(n,"BaseModel",function(){return I}),r.d(n,"I18n",function(){return K})},function(t,n,r){t.exports=r(0)}]); |
{ | ||
"name": "paliari-js-utils", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "Biblioteca de utilidades para JS", | ||
@@ -5,0 +5,0 @@ "main": "dist/paliari-js-utils.js", |
@@ -209,4 +209,3 @@ # paliari-js-utils | ||
isObject({ a: 1 }) // true | ||
isObject('') // false | ||
isObject([]) // false | ||
isObject([]) // true | ||
isObject(1) // false | ||
@@ -216,2 +215,15 @@ isObject(null) // false | ||
### isHash | ||
```js | ||
import { isHash } from 'paliari-js-utils' | ||
isHash({}) // true | ||
isHash({ a: 1 }) // true | ||
isHash('') // false | ||
isHash([]) // false | ||
isHash(1) // false | ||
isHash(null) // false | ||
``` | ||
### isDate | ||
@@ -218,0 +230,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
15261
332