@sorisdk/matcher 0.1.4 → 0.1.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.
Files changed (2) hide show
  1. package/dist/index.js +17 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -423,7 +423,23 @@ function normalizeResult(raw) {
423
423
  afpType
424
424
  };
425
425
  }
426
+ function isMapLike(raw) {
427
+ return raw instanceof Map || Object.prototype.toString.call(raw) === "[object Map]" && typeof raw.entries === "function";
428
+ }
429
+ function toEntryMetadataRecord(raw) {
430
+ if (isMapLike(raw)) {
431
+ const entries = [];
432
+ for (const [key, value] of raw.entries()) {
433
+ if (typeof key === "string") {
434
+ entries.push([key, value]);
435
+ }
436
+ }
437
+ return Object.fromEntries(entries);
438
+ }
439
+ return raw;
440
+ }
426
441
  function normalizeEntryMetadata(raw) {
442
+ const metadata = toEntryMetadataRecord(raw);
427
443
  const {
428
444
  _id: legacyId,
429
445
  id,
@@ -433,7 +449,7 @@ function normalizeEntryMetadata(raw) {
433
449
  name,
434
450
  image,
435
451
  ...rest
436
- } = raw;
452
+ } = metadata;
437
453
  return {
438
454
  ...rest,
439
455
  ...id !== void 0 || legacyId !== void 0 ? { id: String(id ?? legacyId) } : {},
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sorisdk/matcher",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "description": "Browser WASM SDK for audio fingerprint matching",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",