UNPKG

@aikidosec/firewall

Version:

Zen by Aikido is an embedded Web Application Firewall that autonomously protects Node.js apps against common and critical attacks

29 lines (28 loc) 755 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Packages = void 0; class Packages { constructor() { this.packages = new Map(); } addPackage(pkg) { const versions = this.packages.get(pkg.name) || []; const existingVersion = versions.find((v) => v.version === pkg.version); if (existingVersion) { return; } versions.push({ name: pkg.name, version: pkg.version, requiredAt: Date.now(), }); this.packages.set(pkg.name, versions); } asArray() { return Array.from(this.packages.values()).flat(); } clear() { this.packages.clear(); } } exports.Packages = Packages;