@digitalculture/ochre-sdk 0.4.7 → 0.4.8

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.
package/dist/index.cjs CHANGED
@@ -71,9 +71,7 @@ __export(index_exports, {
71
71
  parseStringDocumentItem: () => parseStringDocumentItem,
72
72
  parseStringItem: () => parseStringItem,
73
73
  parseTree: () => parseTree,
74
- parseWebsite: () => parseWebsite,
75
- trimEndLineBreaks: () => trimEndLineBreaks,
76
- trimStartLineBreaks: () => trimStartLineBreaks
74
+ parseWebsite: () => parseWebsite
77
75
  });
78
76
  module.exports = __toCommonJS(index_exports);
79
77
 
@@ -259,7 +257,7 @@ function parseStringItem(item) {
259
257
  break;
260
258
  }
261
259
  }
262
- return trimStartLineBreaks(trimEndLineBreaks(returnString));
260
+ return returnString;
263
261
  }
264
262
  function parseStringDocumentItem(item, footnotes) {
265
263
  if (typeof item === "string" || typeof item === "number" || typeof item === "boolean") {
@@ -382,23 +380,7 @@ function parseStringDocumentItem(item, footnotes) {
382
380
  );
383
381
  }
384
382
  }
385
- return trimStartLineBreaks(trimEndLineBreaks(returnString));
386
- }
387
- function trimEndLineBreaks(string) {
388
- const trimmedString = string.replaceAll(/^\n<br \/>|\n<br \/>$/g, "");
389
- const finalLineBreaks = /\n<br \/>$/.exec(trimmedString);
390
- if (finalLineBreaks) {
391
- return trimEndLineBreaks(trimmedString);
392
- }
393
- return trimmedString;
394
- }
395
- function trimStartLineBreaks(string) {
396
- const trimmedString = string.replaceAll(/^<br \/>\n|<br \/>\n$/g, "");
397
- const leadingLineBreaks = /^<br \/>\n/.exec(trimmedString);
398
- if (leadingLineBreaks) {
399
- return trimStartLineBreaks(trimmedString);
400
- }
401
- return trimmedString;
383
+ return returnString;
402
384
  }
403
385
  function parseStringContent(content, language = "eng") {
404
386
  switch (typeof content.content) {
@@ -801,7 +783,6 @@ function parseDocument(document, language = "eng") {
801
783
  returnString += parseStringDocumentItem(item, footnotes);
802
784
  }
803
785
  }
804
- returnString = trimEndLineBreaks(returnString);
805
786
  return { content: returnString, footnotes };
806
787
  }
807
788
  function parseImage(image) {
@@ -2700,7 +2681,5 @@ async function fetchWebsite(abbreviation) {
2700
2681
  parseStringDocumentItem,
2701
2682
  parseStringItem,
2702
2683
  parseTree,
2703
- parseWebsite,
2704
- trimEndLineBreaks,
2705
- trimStartLineBreaks
2684
+ parseWebsite
2706
2685
  });
package/dist/index.d.cts CHANGED
@@ -1827,32 +1827,6 @@ declare function parseStringItem(item: OchreStringItem): string;
1827
1827
  * @returns Formatted string with HTML/markdown elements
1828
1828
  */
1829
1829
  declare function parseStringDocumentItem(item: OchreStringRichTextItem, footnotes?: Array<Footnote>): string;
1830
- /**
1831
- * Removes trailing line breaks from a string
1832
- *
1833
- * @param string - Input string to trim
1834
- * @returns String with trailing line breaks removed
1835
- *
1836
- * @example
1837
- * ```ts
1838
- * const trimmed = trimEndLineBreaks("Hello\n<br />\n<br />");
1839
- * // Returns: "Hello"
1840
- * ```
1841
- */
1842
- declare function trimEndLineBreaks(string: string): string;
1843
- /**
1844
- * Removes leading line breaks from a string
1845
- *
1846
- * @param string - Input string to trim
1847
- * @returns String with leading line breaks removed
1848
- *
1849
- * @example
1850
- * ```ts
1851
- * const trimmed = trimStartLineBreaks("<br />\n<br />\nHello");
1852
- * // Returns: "Hello"
1853
- * ```
1854
- */
1855
- declare function trimStartLineBreaks(string: string): string;
1856
1830
  /**
1857
1831
  * Parses raw string content into a formatted string
1858
1832
  *
@@ -1862,4 +1836,4 @@ declare function trimStartLineBreaks(string: string): string;
1862
1836
  */
1863
1837
  declare function parseStringContent(content: OchreStringContent, language?: string): string;
1864
1838
 
1865
- export { type Bibliography, type Block, type Concept, type Context, type ContextItem, type ContextNode, type Coordinates, type Data, type Document, type Event, type Footnote, type Gallery, type Identification, type Image, type ImageMap, type ImageMapArea, type Interpretation, type License, type Link, type Metadata, type NestedConcept, type NestedResource, type NestedSpatialUnit, type Note, type Observation, type Period, type Person, type Property, type PropertyValue, type PropertyValueType, type Resource, type Set, type SpatialUnit, type Style, type Tree, type WebElement, type WebElementComponent, type WebImage, type Webpage, type WebpageProperties, type Website, type WebsiteProperties, fetchBibliography, fetchByUuid, fetchConcept, fetchGallery, fetchPeriod, fetchResource, fetchSet, fetchSpatialUnit, fetchTree, fetchWebsite, filterProperties, getAllPropertyLabels, getPropertyByLabel, getPropertyValueByLabel, getPropertyValuesByLabel, parseBibliographies, parseBibliography, parseConcept, parseConcepts, parseContext, parseCoordinates, parseDocument, parseEmailAndUrl, parseEvents, parseFakeString, parseIdentification, parseImage, parseImageMap, parseInterpretations, parseLanguages, parseLicense, parseLink, parseLinks, parseMetadata, parseNotes, parseObservation, parseObservations, parsePeriod, parsePeriods, parsePerson, parsePersons, parseProperties, parseResource, parseResources, parseSet, parseSpatialUnit, parseSpatialUnits, parseStringContent, parseStringDocumentItem, parseStringItem, parseTree, parseWebsite, trimEndLineBreaks, trimStartLineBreaks };
1839
+ export { type Bibliography, type Block, type Concept, type Context, type ContextItem, type ContextNode, type Coordinates, type Data, type Document, type Event, type Footnote, type Gallery, type Identification, type Image, type ImageMap, type ImageMapArea, type Interpretation, type License, type Link, type Metadata, type NestedConcept, type NestedResource, type NestedSpatialUnit, type Note, type Observation, type Period, type Person, type Property, type PropertyValue, type PropertyValueType, type Resource, type Set, type SpatialUnit, type Style, type Tree, type WebElement, type WebElementComponent, type WebImage, type Webpage, type WebpageProperties, type Website, type WebsiteProperties, fetchBibliography, fetchByUuid, fetchConcept, fetchGallery, fetchPeriod, fetchResource, fetchSet, fetchSpatialUnit, fetchTree, fetchWebsite, filterProperties, getAllPropertyLabels, getPropertyByLabel, getPropertyValueByLabel, getPropertyValuesByLabel, parseBibliographies, parseBibliography, parseConcept, parseConcepts, parseContext, parseCoordinates, parseDocument, parseEmailAndUrl, parseEvents, parseFakeString, parseIdentification, parseImage, parseImageMap, parseInterpretations, parseLanguages, parseLicense, parseLink, parseLinks, parseMetadata, parseNotes, parseObservation, parseObservations, parsePeriod, parsePeriods, parsePerson, parsePersons, parseProperties, parseResource, parseResources, parseSet, parseSpatialUnit, parseSpatialUnits, parseStringContent, parseStringDocumentItem, parseStringItem, parseTree, parseWebsite };
package/dist/index.d.ts CHANGED
@@ -1827,32 +1827,6 @@ declare function parseStringItem(item: OchreStringItem): string;
1827
1827
  * @returns Formatted string with HTML/markdown elements
1828
1828
  */
1829
1829
  declare function parseStringDocumentItem(item: OchreStringRichTextItem, footnotes?: Array<Footnote>): string;
1830
- /**
1831
- * Removes trailing line breaks from a string
1832
- *
1833
- * @param string - Input string to trim
1834
- * @returns String with trailing line breaks removed
1835
- *
1836
- * @example
1837
- * ```ts
1838
- * const trimmed = trimEndLineBreaks("Hello\n<br />\n<br />");
1839
- * // Returns: "Hello"
1840
- * ```
1841
- */
1842
- declare function trimEndLineBreaks(string: string): string;
1843
- /**
1844
- * Removes leading line breaks from a string
1845
- *
1846
- * @param string - Input string to trim
1847
- * @returns String with leading line breaks removed
1848
- *
1849
- * @example
1850
- * ```ts
1851
- * const trimmed = trimStartLineBreaks("<br />\n<br />\nHello");
1852
- * // Returns: "Hello"
1853
- * ```
1854
- */
1855
- declare function trimStartLineBreaks(string: string): string;
1856
1830
  /**
1857
1831
  * Parses raw string content into a formatted string
1858
1832
  *
@@ -1862,4 +1836,4 @@ declare function trimStartLineBreaks(string: string): string;
1862
1836
  */
1863
1837
  declare function parseStringContent(content: OchreStringContent, language?: string): string;
1864
1838
 
1865
- export { type Bibliography, type Block, type Concept, type Context, type ContextItem, type ContextNode, type Coordinates, type Data, type Document, type Event, type Footnote, type Gallery, type Identification, type Image, type ImageMap, type ImageMapArea, type Interpretation, type License, type Link, type Metadata, type NestedConcept, type NestedResource, type NestedSpatialUnit, type Note, type Observation, type Period, type Person, type Property, type PropertyValue, type PropertyValueType, type Resource, type Set, type SpatialUnit, type Style, type Tree, type WebElement, type WebElementComponent, type WebImage, type Webpage, type WebpageProperties, type Website, type WebsiteProperties, fetchBibliography, fetchByUuid, fetchConcept, fetchGallery, fetchPeriod, fetchResource, fetchSet, fetchSpatialUnit, fetchTree, fetchWebsite, filterProperties, getAllPropertyLabels, getPropertyByLabel, getPropertyValueByLabel, getPropertyValuesByLabel, parseBibliographies, parseBibliography, parseConcept, parseConcepts, parseContext, parseCoordinates, parseDocument, parseEmailAndUrl, parseEvents, parseFakeString, parseIdentification, parseImage, parseImageMap, parseInterpretations, parseLanguages, parseLicense, parseLink, parseLinks, parseMetadata, parseNotes, parseObservation, parseObservations, parsePeriod, parsePeriods, parsePerson, parsePersons, parseProperties, parseResource, parseResources, parseSet, parseSpatialUnit, parseSpatialUnits, parseStringContent, parseStringDocumentItem, parseStringItem, parseTree, parseWebsite, trimEndLineBreaks, trimStartLineBreaks };
1839
+ export { type Bibliography, type Block, type Concept, type Context, type ContextItem, type ContextNode, type Coordinates, type Data, type Document, type Event, type Footnote, type Gallery, type Identification, type Image, type ImageMap, type ImageMapArea, type Interpretation, type License, type Link, type Metadata, type NestedConcept, type NestedResource, type NestedSpatialUnit, type Note, type Observation, type Period, type Person, type Property, type PropertyValue, type PropertyValueType, type Resource, type Set, type SpatialUnit, type Style, type Tree, type WebElement, type WebElementComponent, type WebImage, type Webpage, type WebpageProperties, type Website, type WebsiteProperties, fetchBibliography, fetchByUuid, fetchConcept, fetchGallery, fetchPeriod, fetchResource, fetchSet, fetchSpatialUnit, fetchTree, fetchWebsite, filterProperties, getAllPropertyLabels, getPropertyByLabel, getPropertyValueByLabel, getPropertyValuesByLabel, parseBibliographies, parseBibliography, parseConcept, parseConcepts, parseContext, parseCoordinates, parseDocument, parseEmailAndUrl, parseEvents, parseFakeString, parseIdentification, parseImage, parseImageMap, parseInterpretations, parseLanguages, parseLicense, parseLink, parseLinks, parseMetadata, parseNotes, parseObservation, parseObservations, parsePeriod, parsePeriods, parsePerson, parsePersons, parseProperties, parseResource, parseResources, parseSet, parseSpatialUnit, parseSpatialUnits, parseStringContent, parseStringDocumentItem, parseStringItem, parseTree, parseWebsite };
package/dist/index.js CHANGED
@@ -180,7 +180,7 @@ function parseStringItem(item) {
180
180
  break;
181
181
  }
182
182
  }
183
- return trimStartLineBreaks(trimEndLineBreaks(returnString));
183
+ return returnString;
184
184
  }
185
185
  function parseStringDocumentItem(item, footnotes) {
186
186
  if (typeof item === "string" || typeof item === "number" || typeof item === "boolean") {
@@ -303,23 +303,7 @@ function parseStringDocumentItem(item, footnotes) {
303
303
  );
304
304
  }
305
305
  }
306
- return trimStartLineBreaks(trimEndLineBreaks(returnString));
307
- }
308
- function trimEndLineBreaks(string) {
309
- const trimmedString = string.replaceAll(/^\n<br \/>|\n<br \/>$/g, "");
310
- const finalLineBreaks = /\n<br \/>$/.exec(trimmedString);
311
- if (finalLineBreaks) {
312
- return trimEndLineBreaks(trimmedString);
313
- }
314
- return trimmedString;
315
- }
316
- function trimStartLineBreaks(string) {
317
- const trimmedString = string.replaceAll(/^<br \/>\n|<br \/>\n$/g, "");
318
- const leadingLineBreaks = /^<br \/>\n/.exec(trimmedString);
319
- if (leadingLineBreaks) {
320
- return trimStartLineBreaks(trimmedString);
321
- }
322
- return trimmedString;
306
+ return returnString;
323
307
  }
324
308
  function parseStringContent(content, language = "eng") {
325
309
  switch (typeof content.content) {
@@ -722,7 +706,6 @@ function parseDocument(document, language = "eng") {
722
706
  returnString += parseStringDocumentItem(item, footnotes);
723
707
  }
724
708
  }
725
- returnString = trimEndLineBreaks(returnString);
726
709
  return { content: returnString, footnotes };
727
710
  }
728
711
  function parseImage(image) {
@@ -2620,7 +2603,5 @@ export {
2620
2603
  parseStringDocumentItem,
2621
2604
  parseStringItem,
2622
2605
  parseTree,
2623
- parseWebsite,
2624
- trimEndLineBreaks,
2625
- trimStartLineBreaks
2606
+ parseWebsite
2626
2607
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digitalculture/ochre-sdk",
3
- "version": "0.4.7",
3
+ "version": "0.4.8",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "description": "Node.js library for working with OCHRE (Online Cultural and Historical Research Environment) data",