Installation

Get started with @lookups/usernames by installing it via your preferred package manager.

npm
npm install @lookups/usernames
yarn
yarn add @lookups/usernames
pnpm
pnpm add @lookups/usernames
bun
bun add @lookups/usernames

Basic Setup

After installation, import the Client class and create a new instance:

import { Client } from "@lookups/usernames";

const client = new Client();

TypeScript

@lookups/usernames is written in TypeScript and includes full type definitions. No additional @types packages are required.

import { Client } from "@lookups/usernames";

const client = new Client();

const result = await client.discord("username");
console.log(result.available);

CommonJS Support

If you're using CommonJS, you can import the package using require:

const { Client } = require("@lookups/usernames");

const client = new Client();

client.discord("username").then(result => {
  console.log(result.available);
});

ESM Support

The package fully supports ES modules with top-level await:

import { Client } from "@lookups/usernames";

const client = new Client();
const result = await client.github("username");

if (result.available) {
  console.log("Username is available!");
} else {
  console.log("Username is taken");
  console.log("Suggestions:", result.suggestions);
}