Optionaloptions: UsjReaderWriterOptionsReturn a copy of text following a given starting point
Point where text extraction will start
Length of text to extract from this USJ data
Return a copy of text between two points
Point where text extraction will start
Point where text extraction will end
Maximum length of string to return (defaults to 100)
Text between the two points, capped at length maxLength
Extract textual notes (aka, "footnotes") from a full USJ object.
An array of MarkerObjects representing all textual notes found in the USJ content.
Given a starting point, find the next location in this USJ data that matches the given text
Text to find. Note you can use an empty string to find the closest text in or after
the start point.
Maximum length of text to search before stopping (default is 1000)
Object containing the USJ node where text begins (it might be split across nodes),
offset within that node that indicates where text begins, and a JSONPath string that
indicates the location of the of USJ node within usj. Note that if the USJ node returned is
an object, it is the same object that is within this USJ data. So if you change it, you are
changing this USJ data.
Find the parent of the first value matching the given JSONPath query within this USJ data
Find the first value matching the given JSONPath query within this USJ data
StaticisDetermine if the passed in marker is the top-level USJ marker.
Note that USJ markers that are not the top-level USJ markers technically should not occur, but they can occur. We should treat them like any other marker. They conform to MarkerObject, so it's not hard to do.
Marker to test if it is USJ marker
true if it is a USJ marker; false otherwise
StaticisDetermine if the USJ document location is pointing to a text content location instead of some location related to a marker object
USJ document location to test
true if the location is for text content; false otherwise
Determine if the USJ document location in this node and document location is pointing to a text content location instead of some location related to a marker object
USJ node and document location to test
true if the location is for text content; false otherwise
Convert a JSONPath query into a SerializedVerseRef and offset
JSONPath search expression that indicates a node within this USJ data. If the expression matches more than one node, then only the first node found is considered. Note that this query must yield a MarkerContent or Usj; JSONPaths yielding properties on nodes are not currently supported.
OptionalbookIdIfNotFound: string3-letter ID of the book this USJ document is in (only used if a book ID is not found in the USJ document)
SerializedVerseRef and offset that represent the location within this USJ data
indicated by jsonPathQuery
Convert a JSONPath query into a USJ node, JSONPath, and offset
JSONPath search expression that indicates a node within this USJ data. If the expression matches more than one node, then only the first node found is considered. Note that this query must yield a MarkerContent or Usj; JSONPaths yielding properties on nodes are not currently supported.
USJ node, JSONPath, and offset that represent the location within this USJ data
indicated by jsonPathQuery
Build a JSONPath query that uniquely identifies the given node with this USJ data.
Determine the location in the USFM representation of this data that corresponds to the location of a node somewhere within this USJ data
JSON object or string in the USJ data to get the USFM location for
OptionalnodeParent: Usj | MarkerObject | MarkerContent[]JSON object that owns the content array that includes node. Required if
node is a string; optional and unused if node is a MarkerObject or Usj
OptionalbookIdIfNotFound: string3-letter ID of the book this USJ document is in (only used if a book ID is not found in the USJ document)
SerializedVerseRef and offset representing the location of node, if one could be
found
Determine the location in the USJ document that corresponds to the location of a node somewhere within this USJ data
JSON object or string in the USJ data to get the USJ location for
OptionalnodeParent: Usj | MarkerObject | MarkerContent[]JSON object that owns the content array that includes node. Required if
node is a string; optional and unused if node is a MarkerObject or Usj
Node, JSONPath, and offset info representing the location of node, if one could be
found
Remove all nodes from this USJ data that match a given search function.
Function that returns true if the given node should be removed
Number of nodes removed
Search for matches of a regular expression within this USJ's text data
Regular expression to search for. Specify the global flag to find all matches.
Array of UsjSearchResult objects that match the given regular expression
Transforms the USJ document into USFM
Get the index in the USFM representation of this data relative to the start of the document that corresponds to the absolute verse location in USFM space passed in
The location in USFM space relative to a verse to get the index for
Index in the USFM representation of this data relative to the start of the document
Get the node + offset and JSONPath query within this USJ data of the first encountered string after the provided USFM location for a specific verse in a USJ document.
Note: this may return a node that is in a subsequent verse or even chapter depending on how much content the USJ data contains. It simply looks through the rest of the USJ data for the first text node and returns that.
Indicates the location in USFM space (book, chapter, verse, character offset) to find the next text for
Object containing the first USJ text node after verseRef, and a JSONPath string that
indicates the location of the USJ text node within this USJ data.
StaticusfmTransforms a USFM verse-based location into a single standardized format of USFM verse-based location for ease of accessing the location's properties
USFM verse-based location in one of multiple forms
USFM verse-based location in one particular form. Also ensures offset is defined
(defaults to 0 as described in UsfmVerseLocation)
Convert a verse-based location in USFM space into a location in USJ space within this USJ data.
If the USJ document has no book markers in it to determine which book the USJ is in, the
verseRef.book will be ignored, and only the chapter and verse numbers will be used to
determine the location.
Location in USFM space - a book, chapter, verse, and character offset within the verse's USFM
Object containing the USJ location within the USJ document indicated by
usfmVerseLocation.
Convert a verse-based location in USFM space into a node and location in USJ space within this USJ data.
If the USJ document has no book markers in it to determine which book the USJ is in, the
verseRef.book will be ignored, and only the chapter and verse numbers will be used to
determine the location.
Location in USFM space - a book, chapter, verse, and character offset within the verse's USFM
Object containing the USJ node and location within the USJ document indicated by
usfmVerseLocation. Note that if the USJ node returned is an object, it is the same object
that is within this USJ data. So if you change it, you are changing this USJ data.
StaticusjTransforms a USJ book-based location into a single standardized format of USJ book-based location for ease of accessing the location's properties
USJ book-based location in one of multiple forms
USJ book-based location in one particular form.
If erroneously received a UsjChapterLocation, not a UsjBookLocation. Cannot statically transform between those because there is no way to know how to change the JSONPath
Inform this UsjReaderWriter that the underlying USJ object changed. This is needed to clear caches used when querying.
StaticusjTransforms a USJ chapter-based location into a single standardized format of USJ chapter-based location for ease of accessing the location's properties
USJ chapter-based location in one of multiple forms
USJ chapter-based location in one particular form.
If erroneously received a UsjBookLocation, not a UsjChapterLocation. Cannot statically transform between those because there is no way to know how to change the JSONPath
Convert a location in USJ space within this USJ data into a location in USFM space.
Location in USJ space - a jsonPath and other information about where the location is
OptionalbookIdIfNotFound: string3-letter ID of the book this USJ document is in (only used if a book ID is not found in the USJ document)
Location in USFM space that is equivalent to the USJ location specified
Represents USJ formatted scripture with helpful utilities for working with it. Some notable features:
Find Scripture text in the USJ document
extractTextextractTextBetweenPointsfindNextLocationOfMatchingTextsearchusfmVerseLocationToNextTextLocationEdit the USJ document:
removeContentNodesTransform USJ to USFM:
toUsfmTransform USJ document locations to USFM locations and vice versa
usfmVerseLocationToUsjDocumentLocationusjDocumentLocationToUsfmVerseRefVerseLocationUse the version of USFM you need by passing in a custom markers map to the constructor if the version in your USJ document is not supported by default: UsjReaderWriterOptions.markersMap
Notes:
UsjReaderWriterfor the same USJ document as long as possible because there is a significant amount of processing and caching done internally to facilitate various operations. Note that, if the USJ document added toUsjReaderWriterchanges, you must runusjChangedto clear the internal caches and receive accurate results from future method calls