Installation and Setup

Installing @mr_fozan/division-rank

To begin using the division-rank library in your Node.js project, follow these steps:

  1. Install via npm:

    Open your terminal or command prompt and run the following command:

    npm install division-rank

    This command installs the @mr_fozan/division-rank library and its dependencies into your project.

  2. Import into your project:

    In your JavaScript file, import the RankSystem class from @mr_fozan/division-rank:

    const RankSystem  = require('division-rank');
  3. Initialize and Configure:

    Create an instance of RankSystem and configure it with initial divisions and users:

    const initialDivisions = [
        { name: 'Gold', options: { minPoints: 1000, maxPoints: 2000 } },
        { name: 'Silver', options: { minPoints: 500, maxPoints: 999 } }
    ];
    
    const rankSystem = new RankSystem(initialDivisions);

    Replace initialDivisions with your specific configurations for divisions and their corresponding options.

  4. Start Using:

    With rankSystem initialized, you can now utilize its methods to manage and query user divisions based on their ratings.

Configuration

The @mr_fozan/division-rank library allows you to configure divisions and their respective rating thresholds through the RankSystem class. Ensure that you provide valid configurations when initializing RankSystem to accurately reflect your application's division criteria.

This setup guide enables you to seamlessly integrate @mr_fozan/division-rank into your Node.js application, providing robust functionality for managing user divisions based on predefined rating ranges.

Last updated