@e-mc/types 0.3.1 → 0.3.2

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 (2) hide show
  1. package/index.js +2 -4
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -14,8 +14,6 @@ class AbortError extends Error {
14
14
  this.name = 'AbortError';
15
15
  }
16
16
  }
17
- const REGEXP_GLOB = /(?<!\\)(?:(?:[^*]|^)\*{1,2}(?:[^*]|$)|\{[^}]+\}|\[[!^][^\]]+\]|[!?*+@]\([^)]+\))/;
18
- const REGEXP_CASCADE = /^(.+?)(?:\[(.+)\])?$/;
19
17
  const REGEXP_UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
20
18
  const REGEXP_FUNCTION = /^(async\s+)?(function(?:\b|\s+)([\w_$]*)\s*\(([^)]*)\)\s*\{([\S\s]*)\})$/;
21
19
  const ASYNC_FUNCTION = Object.getPrototypeOf(async () => { }).constructor;
@@ -503,7 +501,7 @@ function convertTime(value, format) {
503
501
  }
504
502
  exports.convertTime = convertTime;
505
503
  function hasGlob(value) {
506
- return REGEXP_GLOB.test(value);
504
+ return /(?<!\\)(?:(?:[^*]|^)\*{1,2}(?:[^*]|$)|\{[^}]+\}|\[[!^][^\]]+\]|[!?*+@]\([^)]+\))/.test(value);
507
505
  }
508
506
  exports.hasGlob = hasGlob;
509
507
  function escapePattern(value, lookBehind) {
@@ -572,7 +570,7 @@ function cascadeObject(data, query, fallback) {
572
570
  if (isObject(data) && isString(query)) {
573
571
  const names = query.trim().split(/(?<!\\)\./).map(item => item.indexOf('.') !== -1 ? item.replace(/\\(?=\.)/g, '') : item);
574
572
  for (let i = 0, length = names.length, match, current = data; i < length; ++i) {
575
- if (!(match = REGEXP_CASCADE.exec(names[i]))) {
573
+ if (!(match = /^(.+?)(?:\[(.+)\])?$/.exec(names[i]))) {
576
574
  break;
577
575
  }
578
576
  let index = match[2];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@e-mc/types",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "description": "Type definitions for E-mc.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",