You can see below the API reference of this module.
GitStats(dataPath)
dataPath
: Path to the data file.GitStats
instance.getConfig(callback)
Fetches the configuration object from file (~/.git-stats-config.js
).
callback
: The callback function.initConfig(input, callback)
Inits the configuration field (this.config
).
input
: The path to a custom git-stats configuration file or the configuration object.callback
: The callback function.record(data, callback)
Records a new commit.
data
: The commit data containing:date
(String|Date): The date object or a string in a format that can be parsed.url
(String): The repository remote url.hash
(String): The commit hash._data
(Object): If this field is provided, it should be the content of the git-stats data file as object. It will be modified in-memory and then returned.save
(Boolean): If false
, the result will not be saved in the file.callback
: The callback function.GitStats
instance.record(data, callback)
removeCommit Deletes a specifc commit from the history.
data
: The commit data containing:date
(String|Date): The date object or a string in a format that can be parsed. If not provided, the hash object will be searched in all dates.hash
(String): The commit hash._data
(Object): If this field is provided, it should be the content of the git-stats data file as object. It will be modified in-memory and then returned.save
(Boolean): If false
, the result will not be saved in the file.callback
: The callback function.GitStats
instance.get(callback)
Gets the git stats.
callback
: The callback function.GitStats
instance.save(stats, callback)
Saves the provided stats.
stats
: The stats to be saved.callback
: The callback function.GitStats
instance.iterateDays(data, callback)
Iterate through the days, calling the callback function on each day.
data
: An object containing the following fields:start
(Moment): A Moment
date object representing the start date (default: an year ago).end
(Moment): A Moment
date object representing the end date (default: now).format
(String): The format of the date (default: "MMM D, YYYY"
).callback
: The callback function called with the current day formatted (type: string) and the Moment
date object.GitStats
instance.graph(data, callback)
Creates an object with the stats on the provided period (default: last year).
data
: The object passed to the iterateDays
method.callback
: The callback function.GitStats
instance.calendar(data, callback)
Creates the calendar data for the provided period (default: last year).
data
: The object passed to the graph
method.callback
: The callback function.GitStats
instance.ansiCalendar(options, callback)
Creates the ANSI contributions calendar.
options
: The object passed to the calendar
method.callback
: The callback function.GitStats
instance.authors(options, callback)
Creates an array with the authors of a git repository.
options
: The repo path or an object containing the following fields:repo
(String): The repository path.start
(String): The start date.end
(String): The end date.callback
: The callback function.GitStats
instance.authorsPie(options, callback)
Creates the authors pie.
options
: The repo path or an object containing the following fields:repo
(String): The repository path.radius
(Number): The pie radius.no_ansi
(Boolean): If true
, the pie will not contain ansi characters.raw
(Boolean): If true
, the raw JSON will be displayed.callback
: The callback function.GitStats
instance.globalActivity(options, callback)
Creates the global contributions calendar (all commits made by all committers).
options
: The repo path or an object containing the following fields:repo
(String): The repository path.start
(String): The start date.end
(String): The end date.theme
(String|Object): The calendar theme.raw
(Boolean): If true
, the raw JSON will be displayed.callback
: The callback function.GitStats
instance.此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。