New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@athenna/config

Package Overview
Dependencies
Maintainers
1
Versions
76
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@athenna/config - npm Package Compare versions

Comparing version 3.6.0 to 3.7.0

src/Decorators/Value.d.ts

3

package.json
{
"name": "@athenna/config",
"version": "3.6.0",
"version": "3.7.0",
"description": "Cache and handle environment variables and config files of Athenna.",

@@ -84,2 +84,3 @@ "license": "MIT",

"text-summary",
"lcovonly",
"html"

@@ -86,0 +87,0 @@ ],

@@ -57,2 +57,7 @@ /**

/**
* Push a value to a configuration key that is a valid array.
* If configuration is not an array, an exception will be thrown.
*/
static push(key: string, value: any | any[]): typeof Config;
/**
* Delete the configuration key.

@@ -59,0 +64,0 @@ */

@@ -9,7 +9,8 @@ /**

*/
import { sep, parse } from 'node:path';
import { File, Json, Path, Exec, Module, Is, } from '@athenna/common';
import { loadFile, writeFile } from 'magicast';
import { File, Json, Path, Exec, Module } from '@athenna/common';
import { sep, parse, extname } from 'node:path';
import { RecursiveConfigException } from '#src/Exceptions/RecursiveConfigException';
import { NotSupportedKeyException } from '#src/Exceptions/NotSupportedKeyException';
import { NotValidArrayConfigException } from '#src/Exceptions/NotValidArrayConfigException';
class Config {

@@ -98,2 +99,20 @@ /**

/**
* Push a value to a configuration key that is a valid array.
* If configuration is not an array, an exception will be thrown.
*/
static push(key, value) {
const config = this.configs.get(key, []);
if (!Is.Array(config)) {
throw new NotValidArrayConfigException(key);
}
if (Is.Array(value)) {
config.push(...value);
}
else {
config.push(value);
}
this.configs.set(key, config);
return this;
}
/**
* Delete the configuration key.

@@ -144,2 +163,6 @@ */

static async loadAll(path = Path.config(), safe = false) {
if (extname(path)) {
safe ? this.safeLoad(path) : this.load(path);
return;
}
const files = await Module.getAllJSFilesFrom(path);

@@ -146,0 +169,0 @@ this.fatherConfigPath = path;

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc