Turns GitHubs page source into a unitary structure.
[
{
path: 'https://github.com/octo-linker/chrome-extension/blob/c17911bf8f04146aaf3bbfe1cabaa317cbe2eb55/index.js',
el: <div />
lines: [
{
lineNumber: 2,
value: 'import foo from "foo"',
}
]
}
]
const reader = new BlobReader();
reader.read().forEach((blob) => {
console.log('Blob path', blob.path);
console.log('Total lines', blob.lines.length);
});
Checks if the current page contains a blob. Returns true
if there is at least one blob available, else false
.
Runs the blob reader to preprocess all available blobs on the current page.
Iterates over all blobs and invokes iteratee for each blob. The iteratee is invoked with three arguments: Blob
, index
, collection
.
Required
Type: function
The function invoked per iteration
A blob is a single representation of a source code file on GitHub.com.
Fully-qualified url for this blob.
For example https://github.com/octo-linker/chrome-extension/blob/c17911bf8f04146aaf3bbfe1cabaa317cbe2eb55/index.js
Reference to the DOM node for this blob. Use this reference to make changes on the page.
An array of strings, where each string represents a line of the source code. Useful for code analysis.
For example: [ { value: 'Line 1', lineNumber: 1 } ...]
Line objects are consist of the following fields:
value
: Line contentlineNumber
: Source code line numberaddition
:true
if the line was added or editeddeletion
:true
if the line was deleted
Returns a raw representation of this blob.
Returns a JSON object if blob is a valid JSON file, else null
.