@internetarchive/collection-browser 2.8.1-alpha-webdev7002.2 → 2.8.1-alpha-webdev7002.3

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.
@@ -11,7 +11,8 @@ export function dedupe(facets) {
11
11
  if (!Array.isArray(facets[0])) {
12
12
  const facetsUnnested = facets;
13
13
  let result = [...facetsUnnested];
14
- for (const curFacet of facetsUnnested) {
14
+ for (let i = 0; i < result.length; i++) {
15
+ const curFacet = result[i];
15
16
  result = result.filter(sf => curFacet === sf || !smartFacetEquals(curFacet, sf));
16
17
  }
17
18
  return result;
@@ -1 +1 @@
1
- {"version":3,"file":"dedupe.js","sourceRoot":"","sources":["../../../../src/collection-facets/smart-facets/dedupe.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAExD;;;;;;;GAOG;AACH,MAAM,UAAU,MAAM,CAA0C,MAAS;IACvE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAC9B,MAAM,cAAc,GAAG,MAAsB,CAAC;QAE9C,IAAI,MAAM,GAAiB,CAAC,GAAG,cAAc,CAAC,CAAC;QAC/C,KAAK,MAAM,QAAQ,IAAI,cAAc,EAAE,CAAC;YACtC,MAAM,GAAG,MAAM,CAAC,MAAM,CACpB,EAAE,CAAC,EAAE,CAAC,QAAQ,KAAK,EAAE,IAAI,CAAC,gBAAgB,CAAC,QAAQ,EAAE,EAAE,CAAC,CACzD,CAAC;QACJ,CAAC;QAED,OAAO,MAAW,CAAC;IACrB,CAAC;IAED,MAAM,YAAY,GAAG,MAAwB,CAAC;IAE9C,MAAM,MAAM,GAAmB,EAAE,CAAC;IAClC,KAAK,MAAM,aAAa,IAAI,YAAY,EAAE,CAAC;QACzC,MAAM,SAAS,GAAiB,EAAE,CAAC;QACnC,KAAK,MAAM,QAAQ,IAAI,aAAa,EAAE,CAAC;YACrC,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CACjC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,gBAAgB,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,CAC/C,CAAC;YACF,IAAI,CAAC,QAAQ;gBAAE,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC1C,CAAC;QACD,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACzB,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACzB,CAAC;IACH,CAAC;IAED,OAAO,MAAW,CAAC;AACrB,CAAC","sourcesContent":["import type { SmartFacet } from './models';\nimport { smartFacetEquals } from './smart-facet-equals';\n\n/**\n * Removes any duplicated smart facets from the given array.\n * Smart facets are equal if they have the same `label` and same\n * set of facet refs. Only the first occurrence of a given smart\n * facet is kept.\n * @param facets The array of smart facets to deduplicate\n * @returns A new array containing the deduplicated set of facets\n */\nexport function dedupe<T extends SmartFacet[] | SmartFacet[][]>(facets: T): T {\n if (!Array.isArray(facets[0])) {\n const facetsUnnested = facets as SmartFacet[];\n\n let result: SmartFacet[] = [...facetsUnnested];\n for (const curFacet of facetsUnnested) {\n result = result.filter(\n sf => curFacet === sf || !smartFacetEquals(curFacet, sf),\n );\n }\n\n return result as T;\n }\n\n const facetsNested = facets as SmartFacet[][];\n\n const result: SmartFacet[][] = [];\n for (const curFacetArray of facetsNested) {\n const subresult: SmartFacet[] = [];\n for (const curFacet of curFacetArray) {\n const existing = result.find(sfa =>\n sfa.find(sf => smartFacetEquals(curFacet, sf)),\n );\n if (!existing) subresult.push(curFacet);\n }\n if (subresult.length > 0) {\n result.push(subresult);\n }\n }\n\n return result as T;\n}\n"]}
1
+ {"version":3,"file":"dedupe.js","sourceRoot":"","sources":["../../../../src/collection-facets/smart-facets/dedupe.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MA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;AACrB,CAAC","sourcesContent":["import type { SmartFacet } from './models';\nimport { smartFacetEquals } from './smart-facet-equals';\n\n/**\n * Removes any duplicated smart facets from the given array.\n * Smart facets are equal if they have the same `label` and same\n * set of facet refs. Only the first occurrence of a given smart\n * facet is kept.\n * @param facets The array of smart facets to deduplicate\n * @returns A new array containing the deduplicated set of facets\n */\nexport function dedupe<T extends SmartFacet[] | SmartFacet[][]>(facets: T): T {\n if (!Array.isArray(facets[0])) {\n const facetsUnnested = facets as SmartFacet[];\n\n let result: SmartFacet[] = [...facetsUnnested];\n for (let i = 0; i < result.length; i++) {\n const curFacet = result[i];\n result = result.filter(\n sf => curFacet === sf || !smartFacetEquals(curFacet, sf),\n );\n }\n\n return result as T;\n }\n\n const facetsNested = facets as SmartFacet[][];\n\n const result: SmartFacet[][] = [];\n for (const curFacetArray of facetsNested) {\n const subresult: SmartFacet[] = [];\n for (const curFacet of curFacetArray) {\n const existing = result.find(sfa =>\n sfa.find(sf => smartFacetEquals(curFacet, sf)),\n );\n if (!existing) subresult.push(curFacet);\n }\n if (subresult.length > 0) {\n result.push(subresult);\n }\n }\n\n return result as T;\n}\n"]}
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "The Internet Archive Collection Browser.",
4
4
  "license": "AGPL-3.0-only",
5
5
  "author": "Internet Archive",
6
- "version": "2.8.1-alpha-webdev7002.2",
6
+ "version": "2.8.1-alpha-webdev7002.3",
7
7
  "main": "dist/index.js",
8
8
  "module": "dist/index.js",
9
9
  "scripts": {
@@ -14,7 +14,8 @@ export function dedupe<T extends SmartFacet[] | SmartFacet[][]>(facets: T): T {
14
14
  const facetsUnnested = facets as SmartFacet[];
15
15
 
16
16
  let result: SmartFacet[] = [...facetsUnnested];
17
- for (const curFacet of facetsUnnested) {
17
+ for (let i = 0; i < result.length; i++) {
18
+ const curFacet = result[i];
18
19
  result = result.filter(
19
20
  sf => curFacet === sf || !smartFacetEquals(curFacet, sf),
20
21
  );