npm-restrict
v1.1.0
Published
Package that checks git user email/domain during installation
Maintainers
Readme
NPM Restrict
A package to block installation based on git user domain.
Installation
npm install npm-restrict
Usage
CommonJS
const npmRestrict = require("npm-restrict");
// Add single email or domain
npmRestrict.addBlockedEmail("example.com");
// Add multiple emails or domains
npmRestrict.addBlockedEmails(["domain1.com", "domain2.com"]);
// Check if an email is blocked
const isBlocked = npmRestrict.isEmailBlocked("[email protected]");
// Get current git email
const currentEmail = npmRestrict.getGitEmail();
// Get list of blocked emails/domains
const blockedList = npmRestrict.getBlockedEmails();
// Clear blocked list
npmRestrict.clearBlockedEmails();
ESM
import {
addBlockedEmail,
addBlockedEmails,
isEmailBlocked,
getGitEmail,
getBlockedEmails,
clearBlockedEmails,
} from "npm-restrict";
// Add single email or domain
addBlockedEmail("example.com");
// Add multiple emails or domains
addBlockedEmails(["domain1.com", "domain2.com"]);
// Check if an email is blocked
const isBlocked = isEmailBlocked("[email protected]");
// Get current git email
const currentEmail = getGitEmail();
// Get list of blocked emails/domains
const blockedList = getBlockedEmails();
// Clear blocked list
clearBlockedEmails();