Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

contributions

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

contributions

GitHub Contribution Count

  • 0.8.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

GitHub Contributions

A TypeScript library for the GitHub Contribution Graph.

Usage

  1. Get the contributions for a GitHub user, by name:

    const contributions = await Contributions.forUser('ethomson');
    
  2. Get the days in the contribution graph:

    const days = contributions.getDays();
    
  3. You can iterate and inspect the data in each day:

    1. Get the date, a string in YYYY-MM-DD format:

      day.getDate();
      
    2. Get the number of contributions on that day:

      day.getCount();
      
    3. Get the contribution intensity for the day, which is the number 0-4, where 0 indicates no contributions, and 4 is the most contributions. This maps to the color used to indicate the contribution count for the graph.

      day.getIntensity();
      
    4. Get the color, a string in hexadecimal #xxxxxx format, that GitHub used for displaying this day in the contribution graph (this maps directly to the "intensity" level for the day:

Example

Add the contributions package (eg, npm install contributions). Then:

const { Contributions } = require('contributions')

const contributions = await Contributions.forUser('ethomson');
const days = contributions.getDays();

for (let day of days) {
    console.log(`${day.getDate()}: ${day.getIntensity()}`);
}

License

contributions is released under the MIT license.

See the license file for the full license text.

Keywords

FAQs

Package last updated on 04 Dec 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc