@devgrace/utils
Advanced tools
Comparing version 0.2.1 to 0.2.2
@@ -1,1 +0,1 @@ | ||
export declare const deepEqual: (a: any, b: any) => boolean; | ||
export declare const deepEqual: (source: any, target: any) => boolean; |
export * from './abRandom'; | ||
export * from './asyncNoop'; | ||
export * from './deepCopy'; | ||
export * from './deepEqual'; | ||
export * from './getUniqId'; | ||
@@ -4,0 +6,0 @@ export * from './getUniqTime'; |
@@ -1,1 +0,1 @@ | ||
"use strict";function e(e,t,n,r){return new(n||(n=Promise))((function(o,i){function d(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(d,s)}a((r=r.apply(e,t||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;let t=0,n=0;const r=()=>{const e=(new Date).getTime();return n===e?t+=1:(n=e,t=0),(1e3*e+t)/1e3},o=()=>"undefined"==typeof window&&"undefined"!=typeof global,i=()=>{if(o())return!1;const e=window.navigator.userAgent;return/Android|webOS|iPhone|iPad|iPod|Windows Phone|BlackBerry|IEMobile|Opera Mini/i.test(e)},d=e=>e.replace(/\D/g,"");exports.abRandom=()=>Math.random()<.5?0:1,exports.asyncNoop=()=>e(void 0,void 0,void 0,(function*(){})),exports.extractNumber=d,exports.formatNumberWithCommas=e=>e.toString().replace(/\B(?=(\d{3})+(?!\d))/g,","),exports.formatPhoneNumber=e=>{const t=d(e),n=t.startsWith("02");return 8===t.length?t.replace(/(\d{4})(\d{4})/,"$1-$2"):!n||9!==t.length&&10!==t.length?t.replace(/(\d{3})(\d{3,4})(\d{4})/,"$1-$2-$3"):t.replace(/(\d{2})(\d{3,4})(\d{4})/,"$1-$2-$3")},exports.getOS=()=>{if(o())return"server";if(!!window.navigator.userAgent.match(/ipad|iphone|ipod/i))return"ios";return!!window.navigator.userAgent.match(/Android/i)?"android":i()?"otherMobile":"web"},exports.getUniqId=()=>(1e3*r()).toString(16),exports.getUniqTime=r,exports.getViewportSize=()=>o()?{width:0,height:0}:{width:window.innerWidth,height:window.innerHeight},exports.isClient=()=>!o(),exports.isMobile=i,exports.isServer=o,exports.noop=()=>{}; | ||
"use strict";function e(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{a(r.next(e))}catch(e){i(e)}}function f(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,f)}a((r=r.apply(e,t||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;const t=e=>{if("object"!=typeof e||null===e)return e;if(Array.isArray(e)){const n=[];for(const r of e)n.push(t(r));return n}if(e instanceof Set){const n=new Set;for(const r of e)n.add(t(r));return n}if(e instanceof Map){const n=new Map;for(const[r,o]of e)n.set(t(r),t(o));return n}const n={};for(const r in e)e.hasOwnProperty(r)&&(n[r]=t(e[r]));return n},n=(e,t)=>{if(e===t)return!0;if("object"!=typeof e||"object"!=typeof t||null===e||null===t)return!1;if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[r,o]of e)if(!t.has(r)||!n(o,t.get(r)))return!1;return!0}const r=Object.keys(e),o=Object.keys(t);if(r.length!==o.length)return!1;for(const i of r)if(!o.includes(i)||!n(e[i],t[i]))return!1;return!0};let r=0,o=0;const i=()=>{const e=(new Date).getTime();return o===e?r+=1:(o=e,r=0),(1e3*e+r)/1e3},s=()=>"undefined"==typeof window&&"undefined"!=typeof global,f=()=>{if(s())return!1;const e=window.navigator.userAgent;return/Android|webOS|iPhone|iPad|iPod|Windows Phone|BlackBerry|IEMobile|Opera Mini/i.test(e)},a=e=>e.replace(/\D/g,"");exports.abRandom=()=>Math.random()<.5?0:1,exports.asyncNoop=()=>e(void 0,void 0,void 0,(function*(){})),exports.deepCopy=t,exports.deepEqual=n,exports.extractNumber=a,exports.formatNumberWithCommas=e=>e.toString().replace(/\B(?=(\d{3})+(?!\d))/g,","),exports.formatPhoneNumber=e=>{const t=a(e),n=t.startsWith("02");return 8===t.length?t.replace(/(\d{4})(\d{4})/,"$1-$2"):!n||9!==t.length&&10!==t.length?t.replace(/(\d{3})(\d{3,4})(\d{4})/,"$1-$2-$3"):t.replace(/(\d{2})(\d{3,4})(\d{4})/,"$1-$2-$3")},exports.getOS=()=>{if(s())return"server";if(!!window.navigator.userAgent.match(/ipad|iphone|ipod/i))return"ios";return!!window.navigator.userAgent.match(/Android/i)?"android":f()?"otherMobile":"web"},exports.getUniqId=()=>(1e3*i()).toString(16),exports.getUniqTime=i,exports.getViewportSize=()=>s()?{width:0,height:0}:{width:window.innerWidth,height:window.innerHeight},exports.isClient=()=>!s(),exports.isMobile=f,exports.isServer=s,exports.noop=()=>{}; |
@@ -1,1 +0,1 @@ | ||
export declare const deepEqual: (a: any, b: any) => boolean; | ||
export declare const deepEqual: (source: any, target: any) => boolean; |
export * from './abRandom'; | ||
export * from './asyncNoop'; | ||
export * from './deepCopy'; | ||
export * from './deepEqual'; | ||
export * from './getUniqId'; | ||
@@ -4,0 +6,0 @@ export * from './getUniqTime'; |
@@ -1,1 +0,1 @@ | ||
const e=()=>Math.random()<.5?0:1;function n(e,n,t,i){return new(t||(t=Promise))((function(r,o){function d(e){try{c(i.next(e))}catch(e){o(e)}}function a(e){try{c(i.throw(e))}catch(e){o(e)}}function c(e){var n;e.done?r(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(d,a)}c((i=i.apply(e,n||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;const t=()=>n(void 0,void 0,void 0,(function*(){}));let i=0,r=0;const o=()=>{const e=(new Date).getTime();return r===e?i+=1:(r=e,i=0),(1e3*e+i)/1e3},d=()=>(1e3*o()).toString(16),a=()=>"undefined"==typeof window&&"undefined"!=typeof global,c=()=>a()?{width:0,height:0}:{width:window.innerWidth,height:window.innerHeight},u=()=>{},h=()=>{if(a())return!1;const e=window.navigator.userAgent;return/Android|webOS|iPhone|iPad|iPod|Windows Phone|BlackBerry|IEMobile|Opera Mini/i.test(e)},s=()=>{if(a())return"server";if(!!window.navigator.userAgent.match(/ipad|iphone|ipod/i))return"ios";return!!window.navigator.userAgent.match(/Android/i)?"android":h()?"otherMobile":"web"},w=()=>!a(),p=e=>e.replace(/\D/g,""),g=e=>{const n=p(e),t=n.startsWith("02");return 8===n.length?n.replace(/(\d{4})(\d{4})/,"$1-$2"):!t||9!==n.length&&10!==n.length?n.replace(/(\d{3})(\d{3,4})(\d{4})/,"$1-$2-$3"):n.replace(/(\d{2})(\d{3,4})(\d{4})/,"$1-$2-$3")},f=e=>e.toString().replace(/\B(?=(\d{3})+(?!\d))/g,",");export{e as abRandom,t as asyncNoop,p as extractNumber,f as formatNumberWithCommas,g as formatPhoneNumber,s as getOS,d as getUniqId,o as getUniqTime,c as getViewportSize,w as isClient,h as isMobile,a as isServer,u as noop}; | ||
const e=()=>Math.random()<.5?0:1;function n(e,n,t,r){return new(t||(t=Promise))((function(o,i){function f(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var n;e.done?o(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(f,s)}c((r=r.apply(e,n||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;const t=()=>n(void 0,void 0,void 0,(function*(){})),r=e=>{if("object"!=typeof e||null===e)return e;if(Array.isArray(e)){const n=[];for(const t of e)n.push(r(t));return n}if(e instanceof Set){const n=new Set;for(const t of e)n.add(r(t));return n}if(e instanceof Map){const n=new Map;for(const[t,o]of e)n.set(r(t),r(o));return n}const n={};for(const t in e)e.hasOwnProperty(t)&&(n[t]=r(e[t]));return n},o=(e,n)=>{if(e===n)return!0;if("object"!=typeof e||"object"!=typeof n||null===e||null===n)return!1;if(e instanceof Set&&n instanceof Set){if(e.size!==n.size)return!1;for(const t of e)if(!n.has(t))return!1;return!0}if(e instanceof Map&&n instanceof Map){if(e.size!==n.size)return!1;for(const[t,r]of e)if(!n.has(t)||!o(r,n.get(t)))return!1;return!0}const t=Object.keys(e),r=Object.keys(n);if(t.length!==r.length)return!1;for(const i of t)if(!r.includes(i)||!o(e[i],n[i]))return!1;return!0};let i=0,f=0;const s=()=>{const e=(new Date).getTime();return f===e?i+=1:(f=e,i=0),(1e3*e+i)/1e3},c=()=>(1e3*s()).toString(16),a=()=>"undefined"==typeof window&&"undefined"!=typeof global,u=()=>a()?{width:0,height:0}:{width:window.innerWidth,height:window.innerHeight},d=()=>{},h=()=>{if(a())return!1;const e=window.navigator.userAgent;return/Android|webOS|iPhone|iPad|iPod|Windows Phone|BlackBerry|IEMobile|Opera Mini/i.test(e)},p=()=>{if(a())return"server";if(!!window.navigator.userAgent.match(/ipad|iphone|ipod/i))return"ios";return!!window.navigator.userAgent.match(/Android/i)?"android":h()?"otherMobile":"web"},l=()=>!a(),w=e=>e.replace(/\D/g,""),g=e=>{const n=w(e),t=n.startsWith("02");return 8===n.length?n.replace(/(\d{4})(\d{4})/,"$1-$2"):!t||9!==n.length&&10!==n.length?n.replace(/(\d{3})(\d{3,4})(\d{4})/,"$1-$2-$3"):n.replace(/(\d{2})(\d{3,4})(\d{4})/,"$1-$2-$3")},y=e=>e.toString().replace(/\B(?=(\d{3})+(?!\d))/g,",");export{e as abRandom,t as asyncNoop,r as deepCopy,o as deepEqual,w as extractNumber,y as formatNumberWithCommas,g as formatPhoneNumber,p as getOS,c as getUniqId,s as getUniqTime,u as getViewportSize,l as isClient,h as isMobile,a as isServer,d as noop}; |
{ | ||
"name": "@devgrace/utils", | ||
"sideEffects": false, | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"description": "devgrace/utils", | ||
@@ -45,3 +45,3 @@ "main": "dist/cjs/index.js", | ||
], | ||
"gitHead": "75b4f7139ee26924ccb90be4db684f7f373b4e4c" | ||
"gitHead": "13944f6d592c5002a53de50d03d2fee8360ad397" | ||
} |
10390
45
94