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

@makerdao/services-core

Package Overview
Dependencies
Maintainers
17
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@makerdao/services-core - npm Package Compare versions

Comparing version 0.9.5 to 0.9.6

LICENSE

2

package.json
{
"name": "@makerdao/services-core",
"description": "Dependency injection framework",
"version": "0.9.5",
"version": "0.9.6",
"license": "MIT",

@@ -6,0 +6,0 @@ "main": "dist/index.js",

@@ -19,2 +19,9 @@ import values from 'lodash.values';

class ExtractedServiceError extends Error {
constructor(name) {
// prettier-ignore
super('Service with name \'' + name + '\' has been extracted from the core dai.js library into a discrete plugin. Please refer to the documentation here to install and add it to your configuration: \n\n https://github.com/makerdao/dai.js/wiki/Basic-Usage-(Plugins) \n\n');
}
}
// exported just for testing

@@ -56,2 +63,4 @@ export function orderServices(services) {

service(name, throwIfMissing = true) {
const extractedServices = ['exchange'];
if (!name) {

@@ -61,2 +70,6 @@ throw new Error('Provide a service name.');

if (!this._services[name] && throwIfMissing && extractedServices.includes(name)) {
throw new ExtractedServiceError(name);
}
if (!this._services[name] && throwIfMissing) {

@@ -115,2 +128,3 @@ throw new ServiceNotFoundError(name);

Container as default,
ExtractedServiceError,
InvalidServiceError,

@@ -117,0 +131,0 @@ ServiceAlreadyRegisteredError,

import Container, {
ExtractedServiceError,
InvalidServiceError,

@@ -68,2 +69,8 @@ ServiceAlreadyRegisteredError,

test('service() should throw when trying to access an extracted service', () => {
expect(()=> new Container().service('exchange')).toThrow(
ExtractedServiceError.Error
);
});
test('service() should not throw when a service is not found and throwIfMissing = false', () => {

@@ -70,0 +77,0 @@ expect(new Container().service('IDontExist', false)).toBe(undefined);

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