@ohbug/utils 2.0.3 → 2.0.4

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.
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- var s=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var b=Object.prototype.hasOwnProperty;var y=(e,t)=>{for(var o in t)s(e,o,{get:t[o],enumerable:!0})},m=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of f(t))!b.call(e,n)&&n!==o&&s(e,n,{get:()=>t[n],enumerable:!(r=c(t,n))||r.enumerable});return e};var d=e=>m(s({},"__esModule",{value:!0}),e);var H={};y(H,{error:()=>u,getGlobal:()=>l,getOhbugObject:()=>j,getSelector:()=>L,isBrowser:()=>G,isFunction:()=>N,isNode:()=>_,isNumber:()=>x,isObject:()=>w,isPromise:()=>E,isString:()=>O,logger:()=>h,parseUrl:()=>$,replace:()=>P});module.exports=d(H);function u(e,t,...o){if(t===void 0)throw new Error("`Ohbug warning(condition, format, ...args)` requires a warning message argument");if(!e){let r=0,n=t.replace(/%s/g,()=>o[r++]);throw new Error(`Ohbug ${n}`)}}var h={log(...e){console.log(...e)},info(...e){console.info(...e)},warn(...e){console.warn(...e)},error(...e){console.error(...e)}};function O(e){return typeof e=="string"}function x(e){return typeof e=="number"&&parseInt(`${e}`,10)===e}function N(e){return typeof e=="function"}function w(e){return Object.prototype.toString.call(e)==="[object Object]"}function E(e){return e instanceof Promise}var T={};function l(){return typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:T}function j(){let e=l();return u(Boolean(e.__OHBUG__),"Failed to get `OhbugObject`, please confirm if `Ohbug.setup`"),e.__OHBUG__}function _(){return typeof global<"u"}function G(){return typeof window<"u"}function P(e,t,o){if(!(t in e))return;let r=e[t],n=o(r);return e[t]=n,r}function $(e){if(typeof e!="string")return{};let t=e.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!t)return{};let o=t[6]||"",r=t[8]||"";return{host:t[4],path:t[5],protocol:t[2],relative:t[5]+o+r}}function g(e,t){e.parentNode&&(t.push(e.parentNode),g(e.parentNode,t))}function B(e){let t=[];return t.push(e),g(e,t),t}var L=e=>{let t=e.target||e.srcElement,o=e.target||e.srcElement,r=[];for(let i=0;o&&o.nodeType===Node.ELEMENT_NODE&&o.nodeType!==Node.DOCUMENT_TYPE_NODE;o=o.previousSibling)i&&r.push(o),i+=1;let n=typeof e.path>"u"?B(e.target):e.path,{outerHTML:p}=t;return n.reverse().map(i=>(i.localName||"")+(i.id?`#${i.id}`:"")+(i.className?`.${i.className}`:"")+(i.outerHTML===p?`:nth-child(${r.length})`:"")).filter(i=>Boolean(i)).join(" > ")};0&&(module.exports={error,getGlobal,getOhbugObject,getSelector,isBrowser,isFunction,isNode,isNumber,isObject,isPromise,isString,logger,parseUrl,replace});
1
+ "use strict";var a=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var f=Object.prototype.hasOwnProperty;var b=(e,t)=>{for(var o in t)a(e,o,{get:t[o],enumerable:!0})},y=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of c(t))!f.call(e,n)&&n!==o&&a(e,n,{get:()=>t[n],enumerable:!(r=p(t,n))||r.enumerable});return e};var m=e=>y(a({},"__esModule",{value:!0}),e);var L={};b(L,{error:()=>s,getGlobal:()=>u,getOhbugObject:()=>T,getSelector:()=>B,isBrowser:()=>_,isFunction:()=>x,isNode:()=>j,isNumber:()=>O,isObject:()=>N,isPromise:()=>w,isString:()=>h,logger:()=>d,parseUrl:()=>P,replace:()=>G});module.exports=m(L);function s(e,t,...o){if(t===void 0)throw new Error("`Ohbug warning(condition, format, ...args)` requires a warning message argument");if(!e){let r=0,n=t.replace(/%s/g,()=>o[r++]);throw new Error(`Ohbug ${n}`)}}var d={log(...e){console.log(...e)},info(...e){console.info(...e)},warn(...e){console.warn(...e)},error(...e){console.error(...e)}};function h(e){return typeof e=="string"}function O(e){return typeof e=="number"&&parseInt(`${e}`,10)===e}function x(e){return typeof e=="function"}function N(e){return Object.prototype.toString.call(e)==="[object Object]"}function w(e){return e instanceof Promise}var E={};function u(){return typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:E}function T(){let e=u();return s(Boolean(e.__OHBUG__),"Failed to get `OhbugObject`, please confirm if `Ohbug.setup`"),e.__OHBUG__}function j(){return typeof global<"u"}function _(){return typeof window<"u"}function G(e,t,o){if(!(t in e))return;let r=e[t],n=o(r);return e[t]=n,r}function P(e){if(typeof e!="string")return{};let t=e.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!t)return{};let o=t[6]||"",r=t[8]||"";return{host:t[4],path:t[5],protocol:t[2],relative:t[5]+o+r}}function l(e,t){e.parentNode&&(t.push(e.parentNode),l(e.parentNode,t))}function $(e){let t=[];return t.push(e),l(e,t),t}var B=e=>{let t=e.target||e.srcElement,o=e.target||e.srcElement,r=[];for(let i=0;o&&o.nodeType===Node.ELEMENT_NODE&&o.nodeType!==Node.DOCUMENT_TYPE_NODE;o=o.previousSibling)i&&r.push(o),i+=1;let n=typeof e.path>"u"?$(e.target):e.path,{outerHTML:g}=t;return n.reverse().map(i=>(i.localName||"")+(i.id?`#${i.id}`:"")+(i.className?`.${i.className}`:"")+(i.outerHTML===g?`:nth-child(${r.length})`:"")).filter(i=>Boolean(i)).join(" > ")};0&&(module.exports={error,getGlobal,getOhbugObject,getSelector,isBrowser,isFunction,isNode,isNumber,isObject,isPromise,isString,logger,parseUrl,replace});
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- function u(e,t,...o){if(t===void 0)throw new Error("`Ohbug warning(condition, format, ...args)` requires a warning message argument");if(!e){let n=0,s=t.replace(/%s/g,()=>o[n++]);throw new Error(`Ohbug ${s}`)}}var y={log(...e){console.log(...e)},info(...e){console.info(...e)},warn(...e){console.warn(...e)},error(...e){console.error(...e)}};function d(e){return typeof e=="string"}function h(e){return typeof e=="number"&&parseInt(`${e}`,10)===e}function O(e){return typeof e=="function"}function x(e){return Object.prototype.toString.call(e)==="[object Object]"}function N(e){return e instanceof Promise}var p={};function c(){return typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:p}function T(){let e=c();return u(Boolean(e.__OHBUG__),"Failed to get `OhbugObject`, please confirm if `Ohbug.setup`"),e.__OHBUG__}function j(){return typeof global<"u"}function _(){return typeof window<"u"}function P(e,t,o){if(!(t in e))return;let n=e[t],s=o(n);return e[t]=s,n}function $(e){if(typeof e!="string")return{};let t=e.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!t)return{};let o=t[6]||"",n=t[8]||"";return{host:t[4],path:t[5],protocol:t[2],relative:t[5]+o+n}}function l(e,t){e.parentNode&&(t.push(e.parentNode),l(e.parentNode,t))}function f(e){let t=[];return t.push(e),l(e,t),t}var L=e=>{let t=e.target||e.srcElement,o=e.target||e.srcElement,n=[];for(let r=0;o&&o.nodeType===Node.ELEMENT_NODE&&o.nodeType!==Node.DOCUMENT_TYPE_NODE;o=o.previousSibling)r&&n.push(o),r+=1;let s=typeof e.path>"u"?f(e.target):e.path,{outerHTML:g}=t;return s.reverse().map(r=>(r.localName||"")+(r.id?`#${r.id}`:"")+(r.className?`.${r.className}`:"")+(r.outerHTML===g?`:nth-child(${n.length})`:"")).filter(r=>Boolean(r)).join(" > ")};export{u as error,c as getGlobal,T as getOhbugObject,L as getSelector,_ as isBrowser,O as isFunction,j as isNode,h as isNumber,x as isObject,N as isPromise,d as isString,y as logger,$ as parseUrl,P as replace};
1
+ function a(e,t,...o){if(t===void 0)throw new Error("`Ohbug warning(condition, format, ...args)` requires a warning message argument");if(!e){let n=0,i=t.replace(/%s/g,()=>o[n++]);throw new Error(`Ohbug ${i}`)}}var f={log(...e){console.log(...e)},info(...e){console.info(...e)},warn(...e){console.warn(...e)},error(...e){console.error(...e)}};function y(e){return typeof e=="string"}function m(e){return typeof e=="number"&&parseInt(`${e}`,10)===e}function d(e){return typeof e=="function"}function h(e){return Object.prototype.toString.call(e)==="[object Object]"}function O(e){return e instanceof Promise}var l={};function g(){return typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:l}function w(){let e=g();return a(Boolean(e.__OHBUG__),"Failed to get `OhbugObject`, please confirm if `Ohbug.setup`"),e.__OHBUG__}function E(){return typeof global<"u"}function T(){return typeof window<"u"}function _(e,t,o){if(!(t in e))return;let n=e[t],i=o(n);return e[t]=i,n}function G(e){if(typeof e!="string")return{};let t=e.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!t)return{};let o=t[6]||"",n=t[8]||"";return{host:t[4],path:t[5],protocol:t[2],relative:t[5]+o+n}}function s(e,t){e.parentNode&&(t.push(e.parentNode),s(e.parentNode,t))}function p(e){let t=[];return t.push(e),s(e,t),t}var $=e=>{let t=e.target||e.srcElement,o=e.target||e.srcElement,n=[];for(let r=0;o&&o.nodeType===Node.ELEMENT_NODE&&o.nodeType!==Node.DOCUMENT_TYPE_NODE;o=o.previousSibling)r&&n.push(o),r+=1;let i=typeof e.path>"u"?p(e.target):e.path,{outerHTML:u}=t;return i.reverse().map(r=>(r.localName||"")+(r.id?`#${r.id}`:"")+(r.className?`.${r.className}`:"")+(r.outerHTML===u?`:nth-child(${n.length})`:"")).filter(r=>Boolean(r)).join(" > ")};export{a as error,g as getGlobal,w as getOhbugObject,$ as getSelector,T as isBrowser,d as isFunction,E as isNode,m as isNumber,h as isObject,O as isPromise,y as isString,f as logger,G as parseUrl,_ as replace};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ohbug/utils",
3
- "version": "2.0.3",
3
+ "version": "2.0.4",
4
4
  "description": "Utilities for all Ohbug SDKs",
5
5
  "license": "Apache-2.0",
6
6
  "author": "chenyueban <jasonchan0527@gmail.com>",
@@ -30,8 +30,8 @@
30
30
  "access": "public"
31
31
  },
32
32
  "dependencies": {
33
- "@ohbug/types": "2.0.3",
34
- "@types/node": "^17.0.34"
33
+ "@ohbug/types": "2.0.4",
34
+ "@types/node": "^18.0.6"
35
35
  },
36
36
  "scripts": {
37
37
  "build": "tsup",