npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

teamy

v4.1.0

Published

A powerful library to manage teams

Readme

NPM

teamy

A powerful library to manage teams with your own database
Made by HarmoGlace

Table of Contents

Installation

With npm

$ npm install teamy

With yarn

$ yarn add teamy

Recommended node version: 14.12.0 (Current)
Required node version: 14.4.0

Example usage

For a basic teams system using enmap as database provider:

const { TeamsManager } = require('teamy');
const Enmap = require('enmap');
const points = new Enmap({name: 'points'});

const manager = new TeamsManager({
        teams: [
            {
                id: 'cool_team',
                name: 'A pretty cool team'
            },
            {
                id: 'another_cool_team',
                name: 'Another cool team'
            }
        ],
        functions: { // Can be async functions or can return a promise
            setPoints: (team, points) => points.set(team.id, points),
            getPoints: (team) => points.get(team)
        }
});

const coolTeam = manager.get('cool_team');

coolTeam.points.add(500);

coolTeam.points.get(); // returns 500

manager.toArray() // returns an array of all teams

manager.resolve('a pretty cool team') // returns 'a pretty cool team' Team

For an advanced system with parent teams and sub teams and team detection with a role (using discord.js) :

const { TeamsManager } = require('teamy');
const { Client } = require('discord.js');
const client = new Client();
const Enmap = require('enmap');
const pointsDB = new Enmap({name: 'points'});

const manager = new TeamsManager({
    type: 'advanced',
    teams: [
            {
                id: 'parent1',
                role: '123456789', // Optional
                subs: [
                    {
                        id: 'sub1',
                        role: '123456789' // optional, used to detect member role if a client and a guildId are given
                    }
                ]
            },
            {
                id: 'parent2',
                subs: [
                    {
                        id: 'sub2',
                        role: '23456789'
                    }
                ]
            }
        ],
    functions: { // Needed. Used to save points, you can use the database that you want, here it is enmap
        setPoints: (team, points) => pointsDB.set(team.id, points),
        getPoints: (team) => pointsDB.get(team.id)
    },
    client,
    guild: '123456789' // guild Id where these teams belong to. It will be used to get roles
});

const sub1 = manager.get('sub1');

sub1.points.add(153);

sub1.points.get() // return 153

sub1.parent // returns parent Team

client.on('message', message => {
    const team = manager.functions.getMemberTeam(message.member); // returns the member team or null if none is found. See below example for an easier way to do it
})

API Reference

The api reference is available at teamy.harmoglace.fr

How to have a team property on GuildMembers with implement TeamsManager option [optional]

Type: Boolean
Options passed to the TeamsManager, if set to true, it will enable team and teams properties on each GuildMember.
For that you need to instantiate your client after creating the TeamsManager
Example (using a basic manager and with enmap as DB provider):

const { TeamsManager } = require('teamy');
const Enmap = require('enmap');
const points = new Enmap({name: 'points'});

const manager = new TeamsManager({
        teams: [
            {
                id: 'cool_team',
                name: 'A pretty cool team'
            },
            {
                id: 'another_cool_team',
                name: 'Another cool team'
            }
        ],
        functions: {
            setPoints: (team, points) => points.set(team.id, points),
            getPoints: (team) => points.get(team),
   
            getMemberTeam: (member, teams) => teams.find(team => member.roles.cache.has(team.roleId)
        },
        guild: '123456',  // guild Id where all roles are from
        implement: true
});

const { Client } = require('discord.js');
const client = new Client();

manager.client = client;

client.on('message', message => {
    message.member.team; // Returns the member team or null if none is found
})

How to contribute

Please note that teamy is still in development.
If you are here it means that you want to help me, thank you !

To contribute, create a fork of your this project, edit the things that you want and create a Pull Request.

Feedback

Report an issue

If you want to report an issue, open an issue here using the bug report template
Please check that you have the required node version at least and that you have the latest version of teamy

Suggest something

If you want to suggest something you are welcome !
Open an issue here using the suggestion template.

Support

Do you need help ? Join the Teamy Discord server