@jhqn/utils-core 0.0.2-beta.4 → 0.0.2-beta.5

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.cjs CHANGED
@@ -329,14 +329,13 @@ const fixiOSInputAutoZoomIn = () => {
329
329
  const userAgent = inBrowser ? window.navigator.userAgent : "";
330
330
  const getHostEnv = () => {
331
331
  const ua = userAgent.toLowerCase();
332
- const baseInfo = detectBrowserEs.parseUserAgent(ua);
333
332
  const zlb = ua.includes("@zlb");
334
333
  const zyd = ua.includes("saas");
335
334
  const zzd = ua.includes("zhejiang") || ua.includes("tauruszjd");
336
335
  const wx = ua.includes("micromessenger");
337
336
  const zfb = ua.includes("alipay");
338
337
  const mini = ua.includes("miniprogram");
339
- const additionalInfo = {
338
+ const info = {
340
339
  zlb,
341
340
  zyd,
342
341
  zzd,
@@ -344,10 +343,7 @@ const getHostEnv = () => {
344
343
  zfb,
345
344
  mini
346
345
  };
347
- return {
348
- ...baseInfo,
349
- ...additionalInfo
350
- };
346
+ return info;
351
347
  };
352
348
 
353
349
  const parseToJSON = (str, reviver2) => isJSONStr(str) ? JSON.parse(str, reviver2) : null;
@@ -477,6 +473,7 @@ const attachFmt = (data) => {
477
473
  return attachList.map(recoverFile);
478
474
  };
479
475
 
476
+ exports.detect = detectBrowserEs.detect;
480
477
  exports.dayjs = dayjs__default;
481
478
  exports.attachFmt = attachFmt;
482
479
  exports.camel2Kebab = camel2Kebab;
package/dist/index.d.cts CHANGED
@@ -3,9 +3,9 @@
3
3
  /// <reference types="dayjs/plugin/relativeTime" />
4
4
  /// <reference types="dayjs/plugin/customParseFormat" />
5
5
  /// <reference types="dayjs/plugin/objectSupport" />
6
- import * as detect_browser_es from 'detect-browser-es';
7
6
  import { ConfigType } from 'dayjs';
8
7
  export { Dayjs, default as dayjs } from 'dayjs';
8
+ export { detect } from 'detect-browser-es';
9
9
 
10
10
  /**
11
11
  * snake2Kebab
@@ -308,6 +308,33 @@ declare const hideEmail: (email: UnDef<string>) => string;
308
308
  */
309
309
  declare const hideBankCard: (bankCard: UnDef<string>) => string;
310
310
 
311
+ interface HostEnv {
312
+ /**
313
+ * 是否是浙里办
314
+ */
315
+ readonly zlb: boolean
316
+ /**
317
+ * 是否是专有钉
318
+ */
319
+ readonly zyd: boolean
320
+ /**
321
+ * 是否是浙政钉
322
+ */
323
+ readonly zzd: boolean
324
+ /**
325
+ * 是否是微信
326
+ */
327
+ readonly wx: boolean
328
+ /**
329
+ * 是否是支付宝
330
+ */
331
+ readonly zfb: boolean
332
+ /**
333
+ * 是否是小程序
334
+ */
335
+ readonly mini: boolean
336
+ }
337
+
311
338
  /**
312
339
  * 判断是否是浏览器环境
313
340
  */
@@ -330,52 +357,7 @@ declare const userAgent: string;
330
357
  /**
331
358
  * 获取宿主环境信息
332
359
  */
333
- declare const getHostEnv: () => {
334
- zlb: boolean;
335
- zyd: boolean;
336
- zzd: boolean;
337
- wx: boolean;
338
- zfb: boolean;
339
- mini: boolean;
340
- } | {
341
- zlb: boolean;
342
- zyd: boolean;
343
- zzd: boolean;
344
- wx: boolean;
345
- zfb: boolean;
346
- mini: boolean;
347
- name: detect_browser_es.Browser;
348
- version: string;
349
- os: detect_browser_es.OperatingSystem | null;
350
- ua?: detect_browser_es.UserAgentDataInfo | undefined;
351
- type: "browser";
352
- } | {
353
- zlb: boolean;
354
- zyd: boolean;
355
- zzd: boolean;
356
- wx: boolean;
357
- zfb: boolean;
358
- mini: boolean;
359
- name: detect_browser_es.Browser;
360
- version: string;
361
- os: detect_browser_es.OperatingSystem | null;
362
- bot: string;
363
- type: "bot-device";
364
- ua?: detect_browser_es.UserAgentDataInfo | undefined;
365
- } | {
366
- zlb: boolean;
367
- zyd: boolean;
368
- zzd: boolean;
369
- wx: boolean;
370
- zfb: boolean;
371
- mini: boolean;
372
- type: "bot";
373
- bot: true;
374
- name: "bot";
375
- version: null;
376
- os: null;
377
- ua?: detect_browser_es.UserAgentDataInfo | undefined;
378
- };
360
+ declare const getHostEnv: () => HostEnv;
379
361
 
380
362
  /**
381
363
  * Json字符串转对象
package/dist/index.d.mts CHANGED
@@ -3,9 +3,9 @@
3
3
  /// <reference types="dayjs/plugin/relativeTime" />
4
4
  /// <reference types="dayjs/plugin/customParseFormat" />
5
5
  /// <reference types="dayjs/plugin/objectSupport" />
6
- import * as detect_browser_es from 'detect-browser-es';
7
6
  import { ConfigType } from 'dayjs';
8
7
  export { Dayjs, default as dayjs } from 'dayjs';
8
+ export { detect } from 'detect-browser-es';
9
9
 
10
10
  /**
11
11
  * snake2Kebab
@@ -308,6 +308,33 @@ declare const hideEmail: (email: UnDef<string>) => string;
308
308
  */
309
309
  declare const hideBankCard: (bankCard: UnDef<string>) => string;
310
310
 
311
+ interface HostEnv {
312
+ /**
313
+ * 是否是浙里办
314
+ */
315
+ readonly zlb: boolean
316
+ /**
317
+ * 是否是专有钉
318
+ */
319
+ readonly zyd: boolean
320
+ /**
321
+ * 是否是浙政钉
322
+ */
323
+ readonly zzd: boolean
324
+ /**
325
+ * 是否是微信
326
+ */
327
+ readonly wx: boolean
328
+ /**
329
+ * 是否是支付宝
330
+ */
331
+ readonly zfb: boolean
332
+ /**
333
+ * 是否是小程序
334
+ */
335
+ readonly mini: boolean
336
+ }
337
+
311
338
  /**
312
339
  * 判断是否是浏览器环境
313
340
  */
@@ -330,52 +357,7 @@ declare const userAgent: string;
330
357
  /**
331
358
  * 获取宿主环境信息
332
359
  */
333
- declare const getHostEnv: () => {
334
- zlb: boolean;
335
- zyd: boolean;
336
- zzd: boolean;
337
- wx: boolean;
338
- zfb: boolean;
339
- mini: boolean;
340
- } | {
341
- zlb: boolean;
342
- zyd: boolean;
343
- zzd: boolean;
344
- wx: boolean;
345
- zfb: boolean;
346
- mini: boolean;
347
- name: detect_browser_es.Browser;
348
- version: string;
349
- os: detect_browser_es.OperatingSystem | null;
350
- ua?: detect_browser_es.UserAgentDataInfo | undefined;
351
- type: "browser";
352
- } | {
353
- zlb: boolean;
354
- zyd: boolean;
355
- zzd: boolean;
356
- wx: boolean;
357
- zfb: boolean;
358
- mini: boolean;
359
- name: detect_browser_es.Browser;
360
- version: string;
361
- os: detect_browser_es.OperatingSystem | null;
362
- bot: string;
363
- type: "bot-device";
364
- ua?: detect_browser_es.UserAgentDataInfo | undefined;
365
- } | {
366
- zlb: boolean;
367
- zyd: boolean;
368
- zzd: boolean;
369
- wx: boolean;
370
- zfb: boolean;
371
- mini: boolean;
372
- type: "bot";
373
- bot: true;
374
- name: "bot";
375
- version: null;
376
- os: null;
377
- ua?: detect_browser_es.UserAgentDataInfo | undefined;
378
- };
360
+ declare const getHostEnv: () => HostEnv;
379
361
 
380
362
  /**
381
363
  * Json字符串转对象
package/dist/index.d.ts CHANGED
@@ -3,9 +3,9 @@
3
3
  /// <reference types="dayjs/plugin/relativeTime" />
4
4
  /// <reference types="dayjs/plugin/customParseFormat" />
5
5
  /// <reference types="dayjs/plugin/objectSupport" />
6
- import * as detect_browser_es from 'detect-browser-es';
7
6
  import { ConfigType } from 'dayjs';
8
7
  export { Dayjs, default as dayjs } from 'dayjs';
8
+ export { detect } from 'detect-browser-es';
9
9
 
10
10
  /**
11
11
  * snake2Kebab
@@ -308,6 +308,33 @@ declare const hideEmail: (email: UnDef<string>) => string;
308
308
  */
309
309
  declare const hideBankCard: (bankCard: UnDef<string>) => string;
310
310
 
311
+ interface HostEnv {
312
+ /**
313
+ * 是否是浙里办
314
+ */
315
+ readonly zlb: boolean
316
+ /**
317
+ * 是否是专有钉
318
+ */
319
+ readonly zyd: boolean
320
+ /**
321
+ * 是否是浙政钉
322
+ */
323
+ readonly zzd: boolean
324
+ /**
325
+ * 是否是微信
326
+ */
327
+ readonly wx: boolean
328
+ /**
329
+ * 是否是支付宝
330
+ */
331
+ readonly zfb: boolean
332
+ /**
333
+ * 是否是小程序
334
+ */
335
+ readonly mini: boolean
336
+ }
337
+
311
338
  /**
312
339
  * 判断是否是浏览器环境
313
340
  */
@@ -330,52 +357,7 @@ declare const userAgent: string;
330
357
  /**
331
358
  * 获取宿主环境信息
332
359
  */
333
- declare const getHostEnv: () => {
334
- zlb: boolean;
335
- zyd: boolean;
336
- zzd: boolean;
337
- wx: boolean;
338
- zfb: boolean;
339
- mini: boolean;
340
- } | {
341
- zlb: boolean;
342
- zyd: boolean;
343
- zzd: boolean;
344
- wx: boolean;
345
- zfb: boolean;
346
- mini: boolean;
347
- name: detect_browser_es.Browser;
348
- version: string;
349
- os: detect_browser_es.OperatingSystem | null;
350
- ua?: detect_browser_es.UserAgentDataInfo | undefined;
351
- type: "browser";
352
- } | {
353
- zlb: boolean;
354
- zyd: boolean;
355
- zzd: boolean;
356
- wx: boolean;
357
- zfb: boolean;
358
- mini: boolean;
359
- name: detect_browser_es.Browser;
360
- version: string;
361
- os: detect_browser_es.OperatingSystem | null;
362
- bot: string;
363
- type: "bot-device";
364
- ua?: detect_browser_es.UserAgentDataInfo | undefined;
365
- } | {
366
- zlb: boolean;
367
- zyd: boolean;
368
- zzd: boolean;
369
- wx: boolean;
370
- zfb: boolean;
371
- mini: boolean;
372
- type: "bot";
373
- bot: true;
374
- name: "bot";
375
- version: null;
376
- os: null;
377
- ua?: detect_browser_es.UserAgentDataInfo | undefined;
378
- };
360
+ declare const getHostEnv: () => HostEnv;
379
361
 
380
362
  /**
381
363
  * Json字符串转对象
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { parseUserAgent } from 'detect-browser-es';
1
+ export { detect } from 'detect-browser-es';
2
2
  import dayjs from 'dayjs';
3
3
  export { default as dayjs } from 'dayjs';
4
4
  import localeData from 'dayjs/plugin/localeData';
@@ -318,14 +318,13 @@ const fixiOSInputAutoZoomIn = () => {
318
318
  const userAgent = inBrowser ? window.navigator.userAgent : "";
319
319
  const getHostEnv = () => {
320
320
  const ua = userAgent.toLowerCase();
321
- const baseInfo = parseUserAgent(ua);
322
321
  const zlb = ua.includes("@zlb");
323
322
  const zyd = ua.includes("saas");
324
323
  const zzd = ua.includes("zhejiang") || ua.includes("tauruszjd");
325
324
  const wx = ua.includes("micromessenger");
326
325
  const zfb = ua.includes("alipay");
327
326
  const mini = ua.includes("miniprogram");
328
- const additionalInfo = {
327
+ const info = {
329
328
  zlb,
330
329
  zyd,
331
330
  zzd,
@@ -333,10 +332,7 @@ const getHostEnv = () => {
333
332
  zfb,
334
333
  mini
335
334
  };
336
- return {
337
- ...baseInfo,
338
- ...additionalInfo
339
- };
335
+ return info;
340
336
  };
341
337
 
342
338
  const parseToJSON = (str, reviver2) => isJSONStr(str) ? JSON.parse(str, reviver2) : null;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@jhqn/utils-core",
3
3
  "type": "module",
4
- "version": "0.0.2-beta.4",
4
+ "version": "0.0.2-beta.5",
5
5
  "author": "jade-gjz <jiangang.zhang@jaderd.com>",
6
6
  "license": "MIT",
7
7
  "homepage": "https://github.com/jaderd-jh/utils/tree/main/packages/core#readme",