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

@wendellhu/redi

Package Overview
Dependencies
Maintainers
0
Versions
57
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@wendellhu/redi - npm Package Compare versions

Comparing version 0.16.1 to 0.16.2

31

dist/redi.js

@@ -224,4 +224,14 @@ (function (global, factory) {

function QuantityCheckError(id, quantity, actual) {
var _this = this;
var msg = "Expect \"".concat(quantity, "\" dependency items for id \"").concat(prettyPrintIdentifier(id), "\" but get ").concat(actual, ".");
return _super.call(this, msg) || this;
if (actual == 0) {
msg += ' Did you forget to register it?';
}
if (actual > 1) {
msg += ' You register it more than once.';
}
_this = _super.call(this, msg) || this;
_this.quantity = quantity;
_this.actual = actual;
return _this;
}

@@ -1018,3 +1028,3 @@ return QuantityCheckError;

catch (error) {
if (error instanceof DependencyNotFoundError) {
if (error instanceof DependencyNotFoundError || (error instanceof QuantityCheckError && error.actual === 0)) {
throw new DependencyNotFoundForModuleError(ctor, dep.identifier, dep.paramIndex);

@@ -1056,3 +1066,3 @@ }

catch (error) {
if (error instanceof DependencyNotFoundError) {
if (error instanceof DependencyNotFoundError || (error instanceof QuantityCheckError && error.actual === 0)) {
throw new DependencyNotFoundForModuleError(id, dep.identifier, dep.paramIndex);

@@ -1126,3 +1136,10 @@ }

else {
return NotInstantiatedSymbol;
// If the parent injector is missing, we should check quantity with 0 values.
checkQuantity(id, quantity, 0);
if (quantity === exports.Quantity.MANY) {
return [];
}
else {
return null;
}
}

@@ -1133,2 +1150,5 @@ };

}
if (id === Injector) {
return this;
}
if (lookUp === exports.LookUp.SELF) {

@@ -1173,5 +1193,2 @@ return onSelf();

}
if (id === Injector) {
return this;
}
if (this.dependencyCollection.has(id)) {

@@ -1178,0 +1195,0 @@ return onSelf();

import { DependencyIdentifier } from './dependencyIdentifier';
import { RediError } from './error';
import { Quantity } from './types';
export declare class QuantityCheckError extends RediError {
readonly quantity: Quantity;
readonly actual: number;
constructor(id: DependencyIdentifier<any>, quantity: Quantity, actual: number);
}
export declare function checkQuantity(id: DependencyIdentifier<any>, quantity: Quantity, length: number): void;

@@ -4,0 +10,0 @@ export declare function retrieveQuantity<T>(quantity: Quantity, arr: T[]): T[] | T;

@@ -23,7 +23,18 @@ var __extends = (this && this.__extends) || (function () {

function QuantityCheckError(id, quantity, actual) {
var _this = this;
var msg = "Expect \"".concat(quantity, "\" dependency items for id \"").concat(prettyPrintIdentifier(id), "\" but get ").concat(actual, ".");
return _super.call(this, msg) || this;
if (actual == 0) {
msg += ' Did you forget to register it?';
}
if (actual > 1) {
msg += ' You register it more than once.';
}
_this = _super.call(this, msg) || this;
_this.quantity = quantity;
_this.actual = actual;
return _this;
}
return QuantityCheckError;
}(RediError));
export { QuantityCheckError };
export function checkQuantity(id, quantity, length) {

@@ -30,0 +41,0 @@ if ((quantity === Quantity.OPTIONAL && length > 1) ||

@@ -41,2 +41,3 @@ var __extends = (this && this.__extends) || (function () {

import { isAsyncDependencyItem, isAsyncHook, isClassDependencyItem, isCtor, isFactoryDependencyItem, isValueDependencyItem, prettyPrintIdentifier, AsyncHookSymbol, isExistingDependencyItem, } from './dependencyItem';
import { checkQuantity, QuantityCheckError } from './dependencyQuantity';
import { RediError } from './error';

@@ -399,3 +400,3 @@ import { IdleValue } from './idleValue';

catch (error) {
if (error instanceof DependencyNotFoundError) {
if (error instanceof DependencyNotFoundError || (error instanceof QuantityCheckError && error.actual === 0)) {
throw new DependencyNotFoundForModuleError(ctor, dep.identifier, dep.paramIndex);

@@ -437,3 +438,3 @@ }

catch (error) {
if (error instanceof DependencyNotFoundError) {
if (error instanceof DependencyNotFoundError || (error instanceof QuantityCheckError && error.actual === 0)) {
throw new DependencyNotFoundForModuleError(id, dep.identifier, dep.paramIndex);

@@ -507,3 +508,10 @@ }

else {
return NotInstantiatedSymbol;
// If the parent injector is missing, we should check quantity with 0 values.
checkQuantity(id, quantity, 0);
if (quantity === Quantity.MANY) {
return [];
}
else {
return null;
}
}

@@ -514,2 +522,5 @@ };

}
if (id === Injector) {
return this;
}
if (lookUp === LookUp.SELF) {

@@ -554,5 +565,2 @@ return onSelf();

}
if (id === Injector) {
return this;
}
if (this.dependencyCollection.has(id)) {

@@ -559,0 +567,0 @@ return onSelf();

{
"$schema": "https://raw.githubusercontent.com/wzhudev/squirrel/master/src/schema/package.schema.json",
"schema": "https://raw.githubusercontent.com/wzhudev/squirrel/master/src/schema/package.schema.json",
"name": "@wendellhu/redi",
"version": "0.16.1",
"version": "0.16.2",
"description": "A dependency library for TypeScript and JavaScript, along with a binding for React.",

@@ -6,0 +6,0 @@ "author": "Wenzhao Hu<wzhudev@gmail.com>",

@@ -32,3 +32,3 @@ # redi

**View full documentation on [redi.wendell.fun](https://redi.wendell.fun/).**
**View full documentation on [redi.wzhu.dev](https://redi.wzhu.dev/).**

@@ -38,3 +38,2 @@ ## Links

- [Demo TodoMVC](https://wzhudev.github.io/redi-todomvc/) | [source](https://github.com/wzhudev/redi-todomvc)
- [Doc site](https://redi.wendell.fun) | [source](https://github.com/wzhudev/redi-site)
- [Scaffold](https://github.com/wzhudev/redi-starter)

@@ -50,2 +49,1 @@

MIT. Copyright 2021-present Wenzhao Hu.

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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