Type Definitions
AppraisalData
Properties:
Name | Type | Default | Description | ||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
err |
Error
|
null
|
null | A Error object or |
||||||||||||||||||||||||||||
score |
number
|
0 | The sum of all values in the breakdown collection. |
||||||||||||||||||||||||||||
url |
string
|
null | The location of the README that was evaluated. |
||||||||||||||||||||||||||||
breakdown |
object
|
A collection of README file quality measures. |
|||||||||||||||||||||||||||||
Name | Type | Default | Description |
---|---|---|---|
cumulativeCodeBlockLength |
number
|
0 | Amount of code.
|
hasLists |
number
|
0 | Total count of lists.
|
lowCodeBlockPenalty |
number
|
0 | Penalty for lack of code blocks.
|
numberOfCodeBlocks |
number
|
0 | The total count of source code examples on the README.md document.
|
numberOfGifs |
number
|
0 | Number of GIF images.
|
numberOfImages |
number
|
0 | Number of images.
|
numberOfNonCodeSections |
number
|
0 | The total count of sections in the README that do not contain source code.
|
- Source:
Type:
-
object
Examples
// Successfully appraise a high-quality README.
const {ReadmeAppraisal} = require('readme-inspector')
const readmeAppraisal = new ReadmeAppraisal()
const appraisal = readmeAppraisal.for('commonality/readme-inspector')
const WHITESPACE = 2
console.log(JSON.stringify(appraisal, null, WHITESPACE))
// =>
{
"breakdown": {
"cumulativeCodeBlockLength": 10,
"hasLists": 10,
"lowCodeBlockPenalty": 0,
"numberOfCodeBlocks": 40,
"numberOfGifs": 0,
"numberOfImages": 15,
"numberOfNonCodeSections": 30
},
"error": null,
"score": 100,
"url": "commonality/readme-inspector"
}
// Return a `NullAppraisal` for a repository that doesn't
// have a README.
const readmeInspector = require('readme-inspector')
const appraisal =
await readmeInspector.getAppraisal('https://github.com/gregswindle/no-readme')
const WHITESPACE = 2
console.log(JSON.stringify(appraisal, null, WHITESPACE))
// =>
{
"breakdown": {
"cumulativeCodeBlockLength": 0,
"hasLists": 0,
"lowCodeBlockPenalty": 0,
"numberOfCodeBlocks": 0,
"numberOfGifs": 0,
"numberOfImages": 0,
"numberOfNonCodeSections": 0
},
"error": "Could not determine score for https://github.com/gregswindle/no-readme",
"score": 0,
"url": null
}
ReadmeInfo
Properties:
Name | Type | Default | Description |
---|---|---|---|
appraisal |
AppraisalData
|
Represents the quantifiable quality of a README file. |
|
err |
Error
|
null | Provides |
isPresent |
boolean
|
Declares whether a README document was found. |
|
value |
external:Contents
|
A README |
- Source:
Type:
-
object
Example
{
"appraisal":{
"breakdown":{
"cumulativeCodeBlockLength":10,
"hasLists":10,
"lowCodeBlockPenalty":0,
"numberOfCodeBlocks":40,
"numberOfGifs":0,
"numberOfImages":15,
"numberOfNonCodeSections":30
},
"error":null,
"score":100,
"url":null
},
"err":null,
"isPresent":true,
"value":{
"name":"README.md",
"path":"README.md",
"sha":"7a4be917e2f73fe701170753ef31f278936a7499",
"size":37410,
"url":"https://api.github.com/repos/commonality/readme-inspector/contents/README.md?ref=master",
"html_url":"https://github.com/commonality/readme-inspector/blob/master/README.md",
"git_url":"https://api.github.com/repos/commonality/readme-inspector/git/blobs/7a4be917e2f73fe701170753ef31f278936a7499",
"download_url":"https://raw.githubusercontent.com/commonality/readme-inspector/master/README.md",
"type":"file",
"content":"...",
"encoding":"base64",
"_links":{
"self":"https://api.github.com/repos/commonality/readme-inspector/contents/README.md?ref=master",
"git":"https://api.github.com/repos/commonality/readme-inspector/git/blobs/7a4be917e2f73fe701170753ef31f278936a7499",
"html":"https://github.com/commonality/readme-inspector/blob/master/README.md"
}
}
}