reg-cli 0.18.13 → 0.18.14

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.
@@ -3,13 +3,12 @@
3
3
  function isArray(value) {
4
4
  return !Array.isArray ? getTag(value) === "[object Array]" : Array.isArray(value);
5
5
  }
6
- const INFINITY = 1 / 0;
7
6
  function baseToString(value) {
8
7
  if (typeof value == "string") {
9
8
  return value;
10
9
  }
11
10
  let result = value + "";
12
- return result == "0" && 1 / value == -INFINITY ? "-0" : result;
11
+ return result == "0" && 1 / value == -Infinity ? "-0" : result;
13
12
  }
14
13
  function toString(value) {
15
14
  return value == null ? "" : baseToString(value);
@@ -38,11 +37,10 @@
38
37
  function getTag(value) {
39
38
  return value == null ? value === void 0 ? "[object Undefined]" : "[object Null]" : Object.prototype.toString.call(value);
40
39
  }
41
- const EXTENDED_SEARCH_UNAVAILABLE = "Extended search is not available";
42
40
  const INCORRECT_INDEX_TYPE = "Incorrect 'index' type";
43
41
  const LOGICAL_SEARCH_INVALID_QUERY_FOR_KEY = (key) => `Invalid value for key ${key}`;
44
42
  const PATTERN_LENGTH_TOO_LARGE = (max) => `Pattern length exceeds max of ${max}.`;
45
- const MISSING_KEY_PROPERTY = (name2) => `Missing ${name2} property in key`;
43
+ const MISSING_KEY_PROPERTY = (name) => `Missing ${name} property in key`;
46
44
  const INVALID_KEY_WEIGHT_VALUE = (key) => `Property 'weight' in key '${key}' must be a positive integer`;
47
45
  const hasOwn = Object.prototype.hasOwnProperty;
48
46
  class KeyStore {
@@ -84,16 +82,16 @@
84
82
  if (!hasOwn.call(key, "name")) {
85
83
  throw new Error(MISSING_KEY_PROPERTY("name"));
86
84
  }
87
- const name2 = key.name;
88
- src = name2;
85
+ const name = key.name;
86
+ src = name;
89
87
  if (hasOwn.call(key, "weight")) {
90
88
  weight = key.weight;
91
89
  if (weight <= 0) {
92
- throw new Error(INVALID_KEY_WEIGHT_VALUE(name2));
90
+ throw new Error(INVALID_KEY_WEIGHT_VALUE(name));
93
91
  }
94
92
  }
95
- path = createKeyPath(name2);
96
- id = createKeyId(name2);
93
+ path = createKeyPath(name);
94
+ id = createKeyId(name);
97
95
  getFn = key.getFn;
98
96
  }
99
97
  return { path, id, weight, src, getFn };
@@ -149,6 +147,8 @@
149
147
  // When `true`, the algorithm continues searching to the end of the input even if a perfect
150
148
  // match is found before the end of the same input.
151
149
  isCaseSensitive: false,
150
+ // When `true`, the algorithm will ignore diacritics (accents) in comparisons
151
+ ignoreDiacritics: false,
152
152
  // When true, the matching function will continue to the end of a search pattern even if
153
153
  includeScore: false,
154
154
  // List of properties that will be searched. This also supports nested properties.
@@ -315,8 +315,7 @@
315
315
  value: item
316
316
  });
317
317
  });
318
- } else
319
- ;
318
+ } else ;
320
319
  }
321
320
  record.$[keyIndex] = subRecords;
322
321
  } else if (isString(value) && !isBlank(value)) {
@@ -518,6 +517,7 @@
518
517
  }
519
518
  return mask;
520
519
  }
520
+ const stripDiacritics = String.prototype.normalize ? (str) => str.normalize("NFD").replace(/[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]/g, "") : (str) => str;
521
521
  class BitapSearch {
522
522
  constructor(pattern, {
523
523
  location = Config.location,
@@ -527,6 +527,7 @@
527
527
  findAllMatches = Config.findAllMatches,
528
528
  minMatchCharLength = Config.minMatchCharLength,
529
529
  isCaseSensitive = Config.isCaseSensitive,
530
+ ignoreDiacritics = Config.ignoreDiacritics,
530
531
  ignoreLocation = Config.ignoreLocation
531
532
  } = {}) {
532
533
  this.options = {
@@ -537,9 +538,12 @@
537
538
  findAllMatches,
538
539
  minMatchCharLength,
539
540
  isCaseSensitive,
541
+ ignoreDiacritics,
540
542
  ignoreLocation
541
543
  };
542
- this.pattern = isCaseSensitive ? pattern : pattern.toLowerCase();
544
+ pattern = isCaseSensitive ? pattern : pattern.toLowerCase();
545
+ pattern = ignoreDiacritics ? stripDiacritics(pattern) : pattern;
546
+ this.pattern = pattern;
543
547
  this.chunks = [];
544
548
  if (!this.pattern.length) {
545
549
  return;
@@ -569,10 +573,9 @@
569
573
  }
570
574
  }
571
575
  searchIn(text) {
572
- const { isCaseSensitive, includeMatches } = this.options;
573
- if (!isCaseSensitive) {
574
- text = text.toLowerCase();
575
- }
576
+ const { isCaseSensitive, ignoreDiacritics, includeMatches } = this.options;
577
+ text = isCaseSensitive ? text : text.toLowerCase();
578
+ text = ignoreDiacritics ? stripDiacritics(text) : text;
576
579
  if (this.pattern === text) {
577
580
  let result2 = {
578
581
  isMatch: true,
@@ -781,6 +784,7 @@
781
784
  findAllMatches = Config.findAllMatches,
782
785
  minMatchCharLength = Config.minMatchCharLength,
783
786
  isCaseSensitive = Config.isCaseSensitive,
787
+ ignoreDiacritics = Config.ignoreDiacritics,
784
788
  ignoreLocation = Config.ignoreLocation
785
789
  } = {}) {
786
790
  super(pattern);
@@ -792,6 +796,7 @@
792
796
  findAllMatches,
793
797
  minMatchCharLength,
794
798
  isCaseSensitive,
799
+ ignoreDiacritics,
795
800
  ignoreLocation
796
801
  });
797
802
  }
@@ -887,6 +892,7 @@
887
892
  class ExtendedSearch {
888
893
  constructor(pattern, {
889
894
  isCaseSensitive = Config.isCaseSensitive,
895
+ ignoreDiacritics = Config.ignoreDiacritics,
890
896
  includeMatches = Config.includeMatches,
891
897
  minMatchCharLength = Config.minMatchCharLength,
892
898
  ignoreLocation = Config.ignoreLocation,
@@ -898,6 +904,7 @@
898
904
  this.query = null;
899
905
  this.options = {
900
906
  isCaseSensitive,
907
+ ignoreDiacritics,
901
908
  includeMatches,
902
909
  minMatchCharLength,
903
910
  findAllMatches,
@@ -906,7 +913,9 @@
906
913
  threshold,
907
914
  distance
908
915
  };
909
- this.pattern = isCaseSensitive ? pattern : pattern.toLowerCase();
916
+ pattern = isCaseSensitive ? pattern : pattern.toLowerCase();
917
+ pattern = ignoreDiacritics ? stripDiacritics(pattern) : pattern;
918
+ this.pattern = pattern;
910
919
  this.query = parseQuery(this.pattern, this.options);
911
920
  }
912
921
  static condition(_, options) {
@@ -920,8 +929,9 @@
920
929
  score: 1
921
930
  };
922
931
  }
923
- const { includeMatches, isCaseSensitive } = this.options;
932
+ const { includeMatches, isCaseSensitive, ignoreDiacritics } = this.options;
924
933
  text = isCaseSensitive ? text : text.toLowerCase();
934
+ text = ignoreDiacritics ? stripDiacritics(text) : text;
925
935
  let numMatches = 0;
926
936
  let allIndices = [];
927
937
  let totalScore = 0;
@@ -1082,10 +1092,8 @@
1082
1092
  includeScore = Config.includeScore
1083
1093
  } = {}) {
1084
1094
  const transformers = [];
1085
- if (includeMatches)
1086
- transformers.push(transformMatches);
1087
- if (includeScore)
1088
- transformers.push(transformScore);
1095
+ if (includeMatches) transformers.push(transformMatches);
1096
+ if (includeScore) transformers.push(transformScore);
1089
1097
  return results.map((result) => {
1090
1098
  const { idx } = result;
1091
1099
  const data = {
@@ -1103,9 +1111,7 @@
1103
1111
  class Fuse {
1104
1112
  constructor(docs, options = {}, index) {
1105
1113
  this.options = { ...Config, ...options };
1106
- if (this.options.useExtendedSearch && false) {
1107
- throw new Error(EXTENDED_SEARCH_UNAVAILABLE);
1108
- }
1114
+ if (this.options.useExtendedSearch && false) ;
1109
1115
  this._keyStore = new KeyStore(this.options.keys);
1110
1116
  this.setCollection(docs, index);
1111
1117
  }
@@ -1298,7 +1304,7 @@
1298
1304
  return matches;
1299
1305
  }
1300
1306
  }
1301
- Fuse.version = "7.0.0";
1307
+ Fuse.version = "7.1.0";
1302
1308
  Fuse.createIndex = createIndex;
1303
1309
  Fuse.parseIndex = parseIndex;
1304
1310
  Fuse.config = Config;
@@ -1308,48 +1314,9 @@
1308
1314
  {
1309
1315
  register(ExtendedSearch);
1310
1316
  }
1311
- const name = "x-img-diff-js";
1312
1317
  const version = "0.3.5";
1313
- const main = "src/index.js";
1314
- const description = "compare 2 images considering into translation";
1315
- const scripts = {
1316
- build: "docker-compose run --rm emcc && npm run build:demo",
1317
- test: "node test/test_node.js",
1318
- "build:demo": "cp -rf build demo",
1319
- start: "cd demo; http-server -p 8000",
1320
- "gen:postjs": "babel binding-gen/post.js > bindings/post.js",
1321
- deploy: "npm run build:demo && gh-pages -d demo"
1322
- };
1323
- const repository = {
1324
- type: "git",
1325
- url: "git+https://github.com/reg-viz/x-img-diff-js.git"
1326
- };
1327
- const author = "Quramy";
1328
- const license = "MIT";
1329
- const bugs = {
1330
- url: "https://github.com/reg-viz/x-img-diff-js/issues"
1331
- };
1332
- const homepage = "https://github.com/reg-viz/x-img-diff-js#readme";
1333
- const devDependencies = {
1334
- "babel-cli": "^6.26.0",
1335
- "babel-core": "^6.26.0",
1336
- "babel-preset-es2015": "^6.24.1",
1337
- "gh-pages": "^1.0.0",
1338
- "http-server": "^0.10.0",
1339
- pngjs: "^3.3.0"
1340
- };
1341
1318
  const packageJson = {
1342
- name,
1343
- version,
1344
- main,
1345
- description,
1346
- scripts,
1347
- repository,
1348
- author,
1349
- license,
1350
- bugs,
1351
- homepage,
1352
- devDependencies
1319
+ version
1353
1320
  };
1354
1321
  function instantiateCachedURL(dbVersion, url, importObject) {
1355
1322
  const dbName = "wasm-cache";