@weapp-core/shared 1.0.5-alpha.0 → 1.0.6

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.
Files changed (3) hide show
  1. package/dist/index.cjs +128 -129
  2. package/dist/index.js +129 -131
  3. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -33,114 +33,13 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
33
33
  ));
34
34
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
35
35
 
36
- // ../../node_modules/.pnpm/tsup@8.3.5_@swc+core@1.10.4_jiti@2.4.2_postcss@8.4.49_tsx@4.19.2_typescript@5.7.2_yaml@2.6.1/node_modules/tsup/assets/cjs_shims.js
36
+ // ../../node_modules/.pnpm/tsup@8.3.6_@swc+core@1.10.15_jiti@2.4.2_postcss@8.5.1_tsx@4.19.2_typescript@5.7.3_yaml@2.7.0/node_modules/tsup/assets/cjs_shims.js
37
37
  var init_cjs_shims = __esm({
38
- "../../node_modules/.pnpm/tsup@8.3.5_@swc+core@1.10.4_jiti@2.4.2_postcss@8.4.49_tsx@4.19.2_typescript@5.7.2_yaml@2.6.1/node_modules/tsup/assets/cjs_shims.js"() {
38
+ "../../node_modules/.pnpm/tsup@8.3.6_@swc+core@1.10.15_jiti@2.4.2_postcss@8.5.1_tsx@4.19.2_typescript@5.7.3_yaml@2.7.0/node_modules/tsup/assets/cjs_shims.js"() {
39
39
  "use strict";
40
40
  }
41
41
  });
42
42
 
43
- // ../../node_modules/.pnpm/isobject@3.0.1/node_modules/isobject/index.js
44
- var require_isobject = __commonJS({
45
- "../../node_modules/.pnpm/isobject@3.0.1/node_modules/isobject/index.js"(exports2, module2) {
46
- "use strict";
47
- init_cjs_shims();
48
- module2.exports = function isObject2(val) {
49
- return val != null && typeof val === "object" && Array.isArray(val) === false;
50
- };
51
- }
52
- });
53
-
54
- // ../../node_modules/.pnpm/get-value@3.0.1/node_modules/get-value/index.js
55
- var require_get_value = __commonJS({
56
- "../../node_modules/.pnpm/get-value@3.0.1/node_modules/get-value/index.js"(exports2, module2) {
57
- "use strict";
58
- init_cjs_shims();
59
- var isObject2 = require_isobject();
60
- module2.exports = function(target, path, options) {
61
- if (!isObject2(options)) {
62
- options = { default: options };
63
- }
64
- if (!isValidObject(target)) {
65
- return typeof options.default !== "undefined" ? options.default : target;
66
- }
67
- if (typeof path === "number") {
68
- path = String(path);
69
- }
70
- const isArray = Array.isArray(path);
71
- const isString = typeof path === "string";
72
- const splitChar = options.separator || ".";
73
- const joinChar = options.joinChar || (typeof splitChar === "string" ? splitChar : ".");
74
- if (!isString && !isArray) {
75
- return target;
76
- }
77
- if (isString && path in target) {
78
- return isValid(path, target, options) ? target[path] : options.default;
79
- }
80
- let segs = isArray ? path : split(path, splitChar, options);
81
- let len = segs.length;
82
- let idx = 0;
83
- do {
84
- let prop = segs[idx];
85
- if (typeof prop === "number") {
86
- prop = String(prop);
87
- }
88
- while (prop && prop.slice(-1) === "\\") {
89
- prop = join([prop.slice(0, -1), segs[++idx] || ""], joinChar, options);
90
- }
91
- if (prop in target) {
92
- if (!isValid(prop, target, options)) {
93
- return options.default;
94
- }
95
- target = target[prop];
96
- } else {
97
- let hasProp = false;
98
- let n = idx + 1;
99
- while (n < len) {
100
- prop = join([prop, segs[n++]], joinChar, options);
101
- if (hasProp = prop in target) {
102
- if (!isValid(prop, target, options)) {
103
- return options.default;
104
- }
105
- target = target[prop];
106
- idx = n - 1;
107
- break;
108
- }
109
- }
110
- if (!hasProp) {
111
- return options.default;
112
- }
113
- }
114
- } while (++idx < len && isValidObject(target));
115
- if (idx === len) {
116
- return target;
117
- }
118
- return options.default;
119
- };
120
- function join(segs, joinChar, options) {
121
- if (typeof options.join === "function") {
122
- return options.join(segs);
123
- }
124
- return segs[0] + joinChar + segs[1];
125
- }
126
- function split(path, splitChar, options) {
127
- if (typeof options.split === "function") {
128
- return options.split(path);
129
- }
130
- return path.split(splitChar);
131
- }
132
- function isValid(key, target, options) {
133
- if (typeof options.isValid === "function") {
134
- return options.isValid(key, target);
135
- }
136
- return true;
137
- }
138
- function isValidObject(val) {
139
- return isObject2(val) || Array.isArray(val) || typeof val === "function";
140
- }
141
- }
142
- });
143
-
144
43
  // ../../node_modules/.pnpm/is-primitive@3.0.1/node_modules/is-primitive/index.js
145
44
  var require_is_primitive = __commonJS({
146
45
  "../../node_modules/.pnpm/is-primitive@3.0.1/node_modules/is-primitive/index.js"(exports2, module2) {
@@ -155,14 +54,25 @@ var require_is_primitive = __commonJS({
155
54
  }
156
55
  });
157
56
 
57
+ // ../../node_modules/.pnpm/isobject@3.0.1/node_modules/isobject/index.js
58
+ var require_isobject = __commonJS({
59
+ "../../node_modules/.pnpm/isobject@3.0.1/node_modules/isobject/index.js"(exports2, module2) {
60
+ "use strict";
61
+ init_cjs_shims();
62
+ module2.exports = function isObject3(val) {
63
+ return val != null && typeof val === "object" && Array.isArray(val) === false;
64
+ };
65
+ }
66
+ });
67
+
158
68
  // ../../node_modules/.pnpm/is-plain-object@2.0.4/node_modules/is-plain-object/index.js
159
69
  var require_is_plain_object = __commonJS({
160
70
  "../../node_modules/.pnpm/is-plain-object@2.0.4/node_modules/is-plain-object/index.js"(exports2, module2) {
161
71
  "use strict";
162
72
  init_cjs_shims();
163
- var isObject2 = require_isobject();
73
+ var isObject3 = require_isobject();
164
74
  function isObjectObject(o) {
165
- return isObject2(o) === true && Object.prototype.toString.call(o) === "[object Object]";
75
+ return isObject3(o) === true && Object.prototype.toString.call(o) === "[object Object]";
166
76
  }
167
77
  module2.exports = function isPlainObject2(o) {
168
78
  var ctor, prot;
@@ -187,7 +97,7 @@ var require_set_value = __commonJS({
187
97
  var { deleteProperty } = Reflect;
188
98
  var isPrimitive = require_is_primitive();
189
99
  var isPlainObject2 = require_is_plain_object();
190
- var isObject2 = (value) => {
100
+ var isObject3 = (value) => {
191
101
  return typeof value === "object" && value !== null || typeof value === "function";
192
102
  };
193
103
  var isUnsafeKey = (key) => {
@@ -255,7 +165,7 @@ var require_set_value = __commonJS({
255
165
  }
256
166
  return parts;
257
167
  };
258
- var split = (input, options) => {
168
+ var split2 = (input, options) => {
259
169
  if (options && typeof options.split === "function") return options.split(input);
260
170
  if (typeof input === "symbol") return [input];
261
171
  if (Array.isArray(input)) return input;
@@ -278,8 +188,8 @@ var require_set_value = __commonJS({
278
188
  return obj;
279
189
  };
280
190
  var setValue = (target, path, value, options) => {
281
- if (!path || !isObject2(target)) return target;
282
- const keys = split(path, options);
191
+ if (!path || !isObject3(target)) return target;
192
+ const keys = split2(path, options);
283
193
  let obj = target;
284
194
  for (let i = 0; i < keys.length; i++) {
285
195
  const key = keys[i];
@@ -293,14 +203,14 @@ var require_set_value = __commonJS({
293
203
  obj = obj[key] = [];
294
204
  continue;
295
205
  }
296
- if (!isObject2(obj[key])) {
206
+ if (!isObject3(obj[key])) {
297
207
  obj[key] = {};
298
208
  }
299
209
  obj = obj[key];
300
210
  }
301
211
  return target;
302
212
  };
303
- setValue.split = split;
213
+ setValue.split = split2;
304
214
  setValue.cache = /* @__PURE__ */ new Map();
305
215
  setValue.clear = () => {
306
216
  setValue.cache = /* @__PURE__ */ new Map();
@@ -317,8 +227,8 @@ __export(index_exports, {
317
227
  defu: () => defu,
318
228
  defuOverrideArray: () => defuOverrideArray,
319
229
  escapeStringRegexp: () => escapeStringRegexp,
320
- get: () => import_get_value.default,
321
- isObject: () => isObject,
230
+ get: () => index_default,
231
+ isObject: () => isObject2,
322
232
  objectHash: () => import_object_hash.default,
323
233
  removeExtension: () => removeExtension,
324
234
  removeExtensionDeep: () => removeExtensionDeep,
@@ -399,7 +309,96 @@ var defuArrayFn = createDefu((object, key, currentValue) => {
399
309
 
400
310
  // src/index.ts
401
311
  var import_object_hash = __toESM(require("object-hash"), 1);
402
- var import_get_value = __toESM(require_get_value(), 1);
312
+
313
+ // ../../node_modules/.pnpm/get-value@4.0.1/node_modules/get-value/dist/index.mjs
314
+ init_cjs_shims();
315
+ var __defProp2 = Object.defineProperty;
316
+ var __name = (target, value) => __defProp2(target, "name", { value, configurable: true });
317
+ var isObject = /* @__PURE__ */ __name((v) => v !== null && typeof v === "object", "isObject");
318
+ var join = /* @__PURE__ */ __name((segs, joinChar, options) => {
319
+ if (typeof options.join === "function") {
320
+ return options.join(segs);
321
+ }
322
+ return segs[0] + joinChar + segs[1];
323
+ }, "join");
324
+ var split = /* @__PURE__ */ __name((path, splitChar, options) => {
325
+ if (typeof options.split === "function") {
326
+ return options.split(path);
327
+ }
328
+ return path.split(splitChar);
329
+ }, "split");
330
+ var isValid = /* @__PURE__ */ __name((key, target = {}, options) => {
331
+ if (typeof options?.isValid === "function") {
332
+ return options.isValid(key, target);
333
+ }
334
+ return true;
335
+ }, "isValid");
336
+ var isValidObject = /* @__PURE__ */ __name((v) => {
337
+ return isObject(v) || typeof v === "function";
338
+ }, "isValidObject");
339
+ var getValue = /* @__PURE__ */ __name((target, path, options = {}) => {
340
+ if (!isObject(options)) {
341
+ options = { default: options };
342
+ }
343
+ if (!isValidObject(target)) {
344
+ return typeof options.default !== "undefined" ? options.default : target;
345
+ }
346
+ if (typeof path === "number") {
347
+ path = String(path);
348
+ }
349
+ const pathIsArray = Array.isArray(path);
350
+ const pathIsString = typeof path === "string";
351
+ const splitChar = options.separator || ".";
352
+ const joinChar = options.joinChar || (typeof splitChar === "string" ? splitChar : ".");
353
+ if (!pathIsString && !pathIsArray) {
354
+ return target;
355
+ }
356
+ if (target[path] !== void 0) {
357
+ return isValid(path, target, options) ? target[path] : options.default;
358
+ }
359
+ const segs = pathIsArray ? path : split(path, splitChar, options);
360
+ const len = segs.length;
361
+ let idx = 0;
362
+ do {
363
+ let prop = segs[idx];
364
+ if (typeof prop !== "string") {
365
+ prop = String(prop);
366
+ }
367
+ while (prop && prop.slice(-1) === "\\") {
368
+ prop = join([prop.slice(0, -1), segs[++idx] || ""], joinChar, options);
369
+ }
370
+ if (target[prop] !== void 0) {
371
+ if (!isValid(prop, target, options)) {
372
+ return options.default;
373
+ }
374
+ target = target[prop];
375
+ } else {
376
+ let hasProp = false;
377
+ let n = idx + 1;
378
+ while (n < len) {
379
+ prop = join([prop, segs[n++]], joinChar, options);
380
+ if (hasProp = target[prop] !== void 0) {
381
+ if (!isValid(prop, target, options)) {
382
+ return options.default;
383
+ }
384
+ target = target[prop];
385
+ idx = n - 1;
386
+ break;
387
+ }
388
+ }
389
+ if (!hasProp) {
390
+ return options.default;
391
+ }
392
+ }
393
+ } while (++idx < len && isValidObject(target));
394
+ if (idx === len) {
395
+ return target;
396
+ }
397
+ return options.default;
398
+ }, "getValue");
399
+ var index_default = getValue;
400
+
401
+ // src/index.ts
403
402
  var import_set_value = __toESM(require_set_value(), 1);
404
403
  function escapeStringRegexp(str) {
405
404
  return str.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
@@ -426,7 +425,7 @@ var defuOverrideArray = createDefu((obj, key, value) => {
426
425
  return true;
427
426
  }
428
427
  });
429
- function isObject(x) {
428
+ function isObject2(x) {
430
429
  return typeof x === "object" && x !== null;
431
430
  }
432
431
  // Annotate the CommonJS export names for ESM import in node:
@@ -445,27 +444,19 @@ function isObject(x) {
445
444
  });
446
445
  /*! Bundled license information:
447
446
 
448
- isobject/index.js:
449
- (*!
450
- * isobject <https://github.com/jonschlinkert/isobject>
451
- *
452
- * Copyright (c) 2014-2017, Jon Schlinkert.
453
- * Released under the MIT License.
454
- *)
455
-
456
- get-value/index.js:
447
+ is-primitive/index.js:
457
448
  (*!
458
- * get-value <https://github.com/jonschlinkert/get-value>
449
+ * is-primitive <https://github.com/jonschlinkert/is-primitive>
459
450
  *
460
- * Copyright (c) 2014-2018, Jon Schlinkert.
451
+ * Copyright (c) 2014-present, Jon Schlinkert.
461
452
  * Released under the MIT License.
462
453
  *)
463
454
 
464
- is-primitive/index.js:
455
+ isobject/index.js:
465
456
  (*!
466
- * is-primitive <https://github.com/jonschlinkert/is-primitive>
457
+ * isobject <https://github.com/jonschlinkert/isobject>
467
458
  *
468
- * Copyright (c) 2014-present, Jon Schlinkert.
459
+ * Copyright (c) 2014-2017, Jon Schlinkert.
469
460
  * Released under the MIT License.
470
461
  *)
471
462
 
@@ -484,4 +475,12 @@ set-value/index.js:
484
475
  * Copyright (c) Jon Schlinkert (https://github.com/jonschlinkert).
485
476
  * Released under the MIT License.
486
477
  *)
478
+
479
+ get-value/dist/index.mjs:
480
+ (*!
481
+ * get-value <https://github.com/jonschlinkert/get-value>
482
+ *
483
+ * Copyright (c) 2014-present, Jon Schlinkert.
484
+ * Released under the MIT License.
485
+ *)
487
486
  */
package/dist/index.js CHANGED
@@ -27,114 +27,13 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
27
27
  mod
28
28
  ));
29
29
 
30
- // ../../node_modules/.pnpm/tsup@8.3.5_@swc+core@1.10.4_jiti@2.4.2_postcss@8.4.49_tsx@4.19.2_typescript@5.7.2_yaml@2.6.1/node_modules/tsup/assets/esm_shims.js
30
+ // ../../node_modules/.pnpm/tsup@8.3.6_@swc+core@1.10.15_jiti@2.4.2_postcss@8.5.1_tsx@4.19.2_typescript@5.7.3_yaml@2.7.0/node_modules/tsup/assets/esm_shims.js
31
31
  var init_esm_shims = __esm({
32
- "../../node_modules/.pnpm/tsup@8.3.5_@swc+core@1.10.4_jiti@2.4.2_postcss@8.4.49_tsx@4.19.2_typescript@5.7.2_yaml@2.6.1/node_modules/tsup/assets/esm_shims.js"() {
32
+ "../../node_modules/.pnpm/tsup@8.3.6_@swc+core@1.10.15_jiti@2.4.2_postcss@8.5.1_tsx@4.19.2_typescript@5.7.3_yaml@2.7.0/node_modules/tsup/assets/esm_shims.js"() {
33
33
  "use strict";
34
34
  }
35
35
  });
36
36
 
37
- // ../../node_modules/.pnpm/isobject@3.0.1/node_modules/isobject/index.js
38
- var require_isobject = __commonJS({
39
- "../../node_modules/.pnpm/isobject@3.0.1/node_modules/isobject/index.js"(exports, module) {
40
- "use strict";
41
- init_esm_shims();
42
- module.exports = function isObject2(val) {
43
- return val != null && typeof val === "object" && Array.isArray(val) === false;
44
- };
45
- }
46
- });
47
-
48
- // ../../node_modules/.pnpm/get-value@3.0.1/node_modules/get-value/index.js
49
- var require_get_value = __commonJS({
50
- "../../node_modules/.pnpm/get-value@3.0.1/node_modules/get-value/index.js"(exports, module) {
51
- "use strict";
52
- init_esm_shims();
53
- var isObject2 = require_isobject();
54
- module.exports = function(target, path, options) {
55
- if (!isObject2(options)) {
56
- options = { default: options };
57
- }
58
- if (!isValidObject(target)) {
59
- return typeof options.default !== "undefined" ? options.default : target;
60
- }
61
- if (typeof path === "number") {
62
- path = String(path);
63
- }
64
- const isArray = Array.isArray(path);
65
- const isString = typeof path === "string";
66
- const splitChar = options.separator || ".";
67
- const joinChar = options.joinChar || (typeof splitChar === "string" ? splitChar : ".");
68
- if (!isString && !isArray) {
69
- return target;
70
- }
71
- if (isString && path in target) {
72
- return isValid(path, target, options) ? target[path] : options.default;
73
- }
74
- let segs = isArray ? path : split(path, splitChar, options);
75
- let len = segs.length;
76
- let idx = 0;
77
- do {
78
- let prop = segs[idx];
79
- if (typeof prop === "number") {
80
- prop = String(prop);
81
- }
82
- while (prop && prop.slice(-1) === "\\") {
83
- prop = join([prop.slice(0, -1), segs[++idx] || ""], joinChar, options);
84
- }
85
- if (prop in target) {
86
- if (!isValid(prop, target, options)) {
87
- return options.default;
88
- }
89
- target = target[prop];
90
- } else {
91
- let hasProp = false;
92
- let n = idx + 1;
93
- while (n < len) {
94
- prop = join([prop, segs[n++]], joinChar, options);
95
- if (hasProp = prop in target) {
96
- if (!isValid(prop, target, options)) {
97
- return options.default;
98
- }
99
- target = target[prop];
100
- idx = n - 1;
101
- break;
102
- }
103
- }
104
- if (!hasProp) {
105
- return options.default;
106
- }
107
- }
108
- } while (++idx < len && isValidObject(target));
109
- if (idx === len) {
110
- return target;
111
- }
112
- return options.default;
113
- };
114
- function join(segs, joinChar, options) {
115
- if (typeof options.join === "function") {
116
- return options.join(segs);
117
- }
118
- return segs[0] + joinChar + segs[1];
119
- }
120
- function split(path, splitChar, options) {
121
- if (typeof options.split === "function") {
122
- return options.split(path);
123
- }
124
- return path.split(splitChar);
125
- }
126
- function isValid(key, target, options) {
127
- if (typeof options.isValid === "function") {
128
- return options.isValid(key, target);
129
- }
130
- return true;
131
- }
132
- function isValidObject(val) {
133
- return isObject2(val) || Array.isArray(val) || typeof val === "function";
134
- }
135
- }
136
- });
137
-
138
37
  // ../../node_modules/.pnpm/is-primitive@3.0.1/node_modules/is-primitive/index.js
139
38
  var require_is_primitive = __commonJS({
140
39
  "../../node_modules/.pnpm/is-primitive@3.0.1/node_modules/is-primitive/index.js"(exports, module) {
@@ -149,14 +48,25 @@ var require_is_primitive = __commonJS({
149
48
  }
150
49
  });
151
50
 
51
+ // ../../node_modules/.pnpm/isobject@3.0.1/node_modules/isobject/index.js
52
+ var require_isobject = __commonJS({
53
+ "../../node_modules/.pnpm/isobject@3.0.1/node_modules/isobject/index.js"(exports, module) {
54
+ "use strict";
55
+ init_esm_shims();
56
+ module.exports = function isObject3(val) {
57
+ return val != null && typeof val === "object" && Array.isArray(val) === false;
58
+ };
59
+ }
60
+ });
61
+
152
62
  // ../../node_modules/.pnpm/is-plain-object@2.0.4/node_modules/is-plain-object/index.js
153
63
  var require_is_plain_object = __commonJS({
154
64
  "../../node_modules/.pnpm/is-plain-object@2.0.4/node_modules/is-plain-object/index.js"(exports, module) {
155
65
  "use strict";
156
66
  init_esm_shims();
157
- var isObject2 = require_isobject();
67
+ var isObject3 = require_isobject();
158
68
  function isObjectObject(o) {
159
- return isObject2(o) === true && Object.prototype.toString.call(o) === "[object Object]";
69
+ return isObject3(o) === true && Object.prototype.toString.call(o) === "[object Object]";
160
70
  }
161
71
  module.exports = function isPlainObject2(o) {
162
72
  var ctor, prot;
@@ -181,7 +91,7 @@ var require_set_value = __commonJS({
181
91
  var { deleteProperty } = Reflect;
182
92
  var isPrimitive = require_is_primitive();
183
93
  var isPlainObject2 = require_is_plain_object();
184
- var isObject2 = (value) => {
94
+ var isObject3 = (value) => {
185
95
  return typeof value === "object" && value !== null || typeof value === "function";
186
96
  };
187
97
  var isUnsafeKey = (key) => {
@@ -249,7 +159,7 @@ var require_set_value = __commonJS({
249
159
  }
250
160
  return parts;
251
161
  };
252
- var split = (input, options) => {
162
+ var split2 = (input, options) => {
253
163
  if (options && typeof options.split === "function") return options.split(input);
254
164
  if (typeof input === "symbol") return [input];
255
165
  if (Array.isArray(input)) return input;
@@ -272,8 +182,8 @@ var require_set_value = __commonJS({
272
182
  return obj;
273
183
  };
274
184
  var setValue = (target, path, value, options) => {
275
- if (!path || !isObject2(target)) return target;
276
- const keys = split(path, options);
185
+ if (!path || !isObject3(target)) return target;
186
+ const keys = split2(path, options);
277
187
  let obj = target;
278
188
  for (let i = 0; i < keys.length; i++) {
279
189
  const key = keys[i];
@@ -287,14 +197,14 @@ var require_set_value = __commonJS({
287
197
  obj = obj[key] = [];
288
198
  continue;
289
199
  }
290
- if (!isObject2(obj[key])) {
200
+ if (!isObject3(obj[key])) {
291
201
  obj[key] = {};
292
202
  }
293
203
  obj = obj[key];
294
204
  }
295
205
  return target;
296
206
  };
297
- setValue.split = split;
207
+ setValue.split = split2;
298
208
  setValue.cache = /* @__PURE__ */ new Map();
299
209
  setValue.clear = () => {
300
210
  setValue.cache = /* @__PURE__ */ new Map();
@@ -377,9 +287,98 @@ var defuArrayFn = createDefu((object, key, currentValue) => {
377
287
  });
378
288
 
379
289
  // src/index.ts
380
- var import_get_value = __toESM(require_get_value(), 1);
381
- var import_set_value = __toESM(require_set_value(), 1);
382
290
  import objectHash from "object-hash";
291
+
292
+ // ../../node_modules/.pnpm/get-value@4.0.1/node_modules/get-value/dist/index.mjs
293
+ init_esm_shims();
294
+ var __defProp2 = Object.defineProperty;
295
+ var __name = (target, value) => __defProp2(target, "name", { value, configurable: true });
296
+ var isObject = /* @__PURE__ */ __name((v) => v !== null && typeof v === "object", "isObject");
297
+ var join = /* @__PURE__ */ __name((segs, joinChar, options) => {
298
+ if (typeof options.join === "function") {
299
+ return options.join(segs);
300
+ }
301
+ return segs[0] + joinChar + segs[1];
302
+ }, "join");
303
+ var split = /* @__PURE__ */ __name((path, splitChar, options) => {
304
+ if (typeof options.split === "function") {
305
+ return options.split(path);
306
+ }
307
+ return path.split(splitChar);
308
+ }, "split");
309
+ var isValid = /* @__PURE__ */ __name((key, target = {}, options) => {
310
+ if (typeof options?.isValid === "function") {
311
+ return options.isValid(key, target);
312
+ }
313
+ return true;
314
+ }, "isValid");
315
+ var isValidObject = /* @__PURE__ */ __name((v) => {
316
+ return isObject(v) || typeof v === "function";
317
+ }, "isValidObject");
318
+ var getValue = /* @__PURE__ */ __name((target, path, options = {}) => {
319
+ if (!isObject(options)) {
320
+ options = { default: options };
321
+ }
322
+ if (!isValidObject(target)) {
323
+ return typeof options.default !== "undefined" ? options.default : target;
324
+ }
325
+ if (typeof path === "number") {
326
+ path = String(path);
327
+ }
328
+ const pathIsArray = Array.isArray(path);
329
+ const pathIsString = typeof path === "string";
330
+ const splitChar = options.separator || ".";
331
+ const joinChar = options.joinChar || (typeof splitChar === "string" ? splitChar : ".");
332
+ if (!pathIsString && !pathIsArray) {
333
+ return target;
334
+ }
335
+ if (target[path] !== void 0) {
336
+ return isValid(path, target, options) ? target[path] : options.default;
337
+ }
338
+ const segs = pathIsArray ? path : split(path, splitChar, options);
339
+ const len = segs.length;
340
+ let idx = 0;
341
+ do {
342
+ let prop = segs[idx];
343
+ if (typeof prop !== "string") {
344
+ prop = String(prop);
345
+ }
346
+ while (prop && prop.slice(-1) === "\\") {
347
+ prop = join([prop.slice(0, -1), segs[++idx] || ""], joinChar, options);
348
+ }
349
+ if (target[prop] !== void 0) {
350
+ if (!isValid(prop, target, options)) {
351
+ return options.default;
352
+ }
353
+ target = target[prop];
354
+ } else {
355
+ let hasProp = false;
356
+ let n = idx + 1;
357
+ while (n < len) {
358
+ prop = join([prop, segs[n++]], joinChar, options);
359
+ if (hasProp = target[prop] !== void 0) {
360
+ if (!isValid(prop, target, options)) {
361
+ return options.default;
362
+ }
363
+ target = target[prop];
364
+ idx = n - 1;
365
+ break;
366
+ }
367
+ }
368
+ if (!hasProp) {
369
+ return options.default;
370
+ }
371
+ }
372
+ } while (++idx < len && isValidObject(target));
373
+ if (idx === len) {
374
+ return target;
375
+ }
376
+ return options.default;
377
+ }, "getValue");
378
+ var index_default = getValue;
379
+
380
+ // src/index.ts
381
+ var import_set_value = __toESM(require_set_value(), 1);
383
382
  function escapeStringRegexp(str) {
384
383
  return str.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
385
384
  }
@@ -405,10 +404,9 @@ var defuOverrideArray = createDefu((obj, key, value) => {
405
404
  return true;
406
405
  }
407
406
  });
408
- function isObject(x) {
407
+ function isObject2(x) {
409
408
  return typeof x === "object" && x !== null;
410
409
  }
411
- var export_get = import_get_value.default;
412
410
  var export_set = import_set_value.default;
413
411
  export {
414
412
  addExtension,
@@ -416,8 +414,8 @@ export {
416
414
  defu,
417
415
  defuOverrideArray,
418
416
  escapeStringRegexp,
419
- export_get as get,
420
- isObject,
417
+ index_default as get,
418
+ isObject2 as isObject,
421
419
  objectHash,
422
420
  removeExtension,
423
421
  removeExtensionDeep,
@@ -425,27 +423,19 @@ export {
425
423
  };
426
424
  /*! Bundled license information:
427
425
 
428
- isobject/index.js:
429
- (*!
430
- * isobject <https://github.com/jonschlinkert/isobject>
431
- *
432
- * Copyright (c) 2014-2017, Jon Schlinkert.
433
- * Released under the MIT License.
434
- *)
435
-
436
- get-value/index.js:
426
+ is-primitive/index.js:
437
427
  (*!
438
- * get-value <https://github.com/jonschlinkert/get-value>
428
+ * is-primitive <https://github.com/jonschlinkert/is-primitive>
439
429
  *
440
- * Copyright (c) 2014-2018, Jon Schlinkert.
430
+ * Copyright (c) 2014-present, Jon Schlinkert.
441
431
  * Released under the MIT License.
442
432
  *)
443
433
 
444
- is-primitive/index.js:
434
+ isobject/index.js:
445
435
  (*!
446
- * is-primitive <https://github.com/jonschlinkert/is-primitive>
436
+ * isobject <https://github.com/jonschlinkert/isobject>
447
437
  *
448
- * Copyright (c) 2014-present, Jon Schlinkert.
438
+ * Copyright (c) 2014-2017, Jon Schlinkert.
449
439
  * Released under the MIT License.
450
440
  *)
451
441
 
@@ -464,4 +454,12 @@ set-value/index.js:
464
454
  * Copyright (c) Jon Schlinkert (https://github.com/jonschlinkert).
465
455
  * Released under the MIT License.
466
456
  *)
457
+
458
+ get-value/dist/index.mjs:
459
+ (*!
460
+ * get-value <https://github.com/jonschlinkert/get-value>
461
+ *
462
+ * Copyright (c) 2014-present, Jon Schlinkert.
463
+ * Released under the MIT License.
464
+ *)
467
465
  */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@weapp-core/shared",
3
3
  "type": "module",
4
- "version": "1.0.5-alpha.0",
4
+ "version": "1.0.6",
5
5
  "description": "@weapp-core/shared",
6
6
  "author": "ice breaker <1324318532@qq.com>",
7
7
  "license": "MIT",