Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@forestadmin/context

Package Overview
Dependencies
Maintainers
4
Versions
86
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@forestadmin/context - npm Package Compare versions

Comparing version 1.34.5 to 1.35.0

2

package.json
{
"name": "@forestadmin/context",
"version": "1.34.5",
"version": "1.35.0",
"description": "Minimal context management helper for applications and libraries.",

@@ -5,0 +5,0 @@ "main": "src/index.js",

@@ -152,3 +152,3 @@ const Metadata = require('./metadata');

this._metadata.add(path, name, 'class', Class, options);
const instance = this._instanciate(Class, options);
const instance = this._instanciate(path, name, Class, options);
this._setNewValue(name, instance, options);

@@ -173,6 +173,11 @@ return this;

_instanciate(Class, { map } = {}) {
const RealClass = Class.toString().startsWith('class') ? Class : Class();
if (!map) return new RealClass(this.get());
return new RealClass(this._mapContext(map));
_instanciate(path, name, FunctionFactory, { map } = {}) {
try {
const isClass = FunctionFactory.toString().startsWith('class');
const ClassToInstanciate = isClass ? FunctionFactory : FunctionFactory();
const localContext = map ? this._mapContext(map) : this.get();
return new ClassToInstanciate(localContext);
} catch (cause) {
throw new Error(`instanciating a value for path "${path}/${name}"`, { cause });
}
}

@@ -179,0 +184,0 @@

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