@react-pakistan/util-functions 3.0.14 → 3.0.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,6 +5,7 @@
5
5
  */
6
6
  declare const useIPGeoLocation: () => {
7
7
  country: string | null;
8
+ ip: string | null;
8
9
  error: Error | null;
9
10
  isLoading: boolean;
10
11
  };
@@ -5,6 +5,7 @@
5
5
  */
6
6
  declare const useIPGeoLocation: () => {
7
7
  country: string | null;
8
+ ip: string | null;
8
9
  error: Error | null;
9
10
  isLoading: boolean;
10
11
  };
@@ -1 +1 @@
1
- var s=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var h=(t,o)=>{for(var i in o)s(t,i,{get:o[i],enumerable:!0})},E=(t,o,i,u)=>{if(o&&typeof o=="object"||typeof o=="function")for(let n of y(o))!d.call(t,n)&&n!==i&&s(t,n,{get:()=>o[n],enumerable:!(u=f(o,n))||u.enumerable});return t};var p=t=>E(s({},"__esModule",{value:!0}),t);var L={};h(L,{useIPGeoLocation:()=>g});module.exports=p(L);var e=require("react");const g=()=>{const[t,o]=(0,e.useState)(null),[i,u]=(0,e.useState)(null),[n,c]=(0,e.useState)(!0),l="https://api.country.is";return(0,e.useEffect)(()=>{if(t)return;async function a(){c(!0),await fetch(l).then(r=>{if(!r.ok)throw Error(r.statusText);return r.json()}).then(r=>{r&&r.country&&o(r.country)}).catch(r=>u(r)).finally(()=>c(!1))}a()},[t]),{country:t,error:i,isLoading:n}};0&&(module.exports={useIPGeoLocation});
1
+ var s=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var h=(o,n)=>{for(var r in n)s(o,r,{get:n[r],enumerable:!0})},E=(o,n,r,l)=>{if(n&&typeof n=="object"||typeof n=="function")for(let i of d(n))!g.call(o,i)&&i!==r&&s(o,i,{get:()=>n[i],enumerable:!(l=y(n,i))||l.enumerable});return o};var I=o=>E(s({},"__esModule",{value:!0}),o);var m={};h(m,{useIPGeoLocation:()=>L});module.exports=I(m);var u=require("react");const L=()=>{const[o,n]=(0,u.useState)(null),[r,l]=(0,u.useState)(null),[i,c]=(0,u.useState)(null),[a,e]=(0,u.useState)(!0),f="https://api.country.is";return(0,u.useEffect)(()=>{if(r)return;async function p(){e(!0),await fetch(f).then(t=>{if(!t.ok)throw Error(t.statusText);return t.json()}).then(t=>{t&&t.country&&l(t.country),t&&t.ip&&n(t.ip)}).catch(t=>c(t)).finally(()=>e(!1))}p()},[r]),{country:r,ip:o,error:i,isLoading:a}};0&&(module.exports={useIPGeoLocation});
@@ -1 +1 @@
1
- import{useState as r,useEffect as a}from"react";const y=()=>{const[o,i]=r(null),[e,u]=r(null),[s,n]=r(!0),c="https://api.country.is";return a(()=>{if(o)return;async function l(){n(!0),await fetch(c).then(t=>{if(!t.ok)throw Error(t.statusText);return t.json()}).then(t=>{t&&t.country&&i(t.country)}).catch(t=>u(t)).finally(()=>n(!1))}l()},[o]),{country:o,error:e,isLoading:s}};export{y as useIPGeoLocation};
1
+ import{useState as n,useEffect as p}from"react";const d=()=>{const[i,u]=n(null),[o,l]=n(null),[s,e]=n(null),[c,r]=n(!0),a="https://api.country.is";return p(()=>{if(o)return;async function f(){r(!0),await fetch(a).then(t=>{if(!t.ok)throw Error(t.statusText);return t.json()}).then(t=>{t&&t.country&&l(t.country),t&&t.ip&&u(t.ip)}).catch(t=>e(t)).finally(()=>r(!1))}f()},[o]),{country:o,ip:i,error:s,isLoading:c}};export{d as useIPGeoLocation};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-pakistan/util-functions",
3
- "version": "3.0.14",
3
+ "version": "3.0.15",
4
4
  "description": "A library of all util functions",
5
5
  "scripts": {
6
6
  "add:tags": "scripts/add-tags.sh",