UNPKG

@aikidosec/firewall

Version:

Zen by Aikido is an embedded Application Firewall that autonomously protects Node.js apps against common and critical attacks, provides rate limiting, detects malicious traffic (including bots), and more.

40 lines (39 loc) 1.07 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Package = void 0; const VersionedPackage_1 = require("./VersionedPackage"); /** * Represents an installed package that can have multiple versions. * * When the package is required, you can wrap methods from the exports objects. * * Not to be used for built-in node modules. */ class Package { constructor(packageName) { this.packageName = packageName; this.versions = []; this.assertValidPackageName(this.packageName); } assertValidPackageName(name) { if (!name) { throw new Error("Package name is required"); } } getName() { return this.packageName; } setName(name) { this.assertValidPackageName(name); this.packageName = name; } withVersion(range) { const pkg = new VersionedPackage_1.VersionedPackage(range); this.versions.push(pkg); return pkg; } getVersions() { return this.versions; } } exports.Package = Package;