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

reactive-di

Package Overview
Dependencies
Maintainers
1
Versions
134
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

reactive-di - npm Package Compare versions

Comparing version 1.1.10 to 1.1.11

2

dist/core/__tests__/annotationTest.js

@@ -130,3 +130,3 @@ 'use strict';

var newDi /*: Container*/ = (0, _createContainer.createContainer)([(0, _configurations.klass)(A), (0, _configurations.klass)(B)]);
var newDi /*: Container*/ = (0, _createContainer.createContainer)([[A, (0, _configurations.klass)()], [B, (0, _configurations.klass)()]]);
var result = newDi.get(B);

@@ -133,0 +133,0 @@ (0, _powerAssert2.default)(_rec4._expr(_rec4._capt(_rec4._capt(result, 'arguments/0/left') instanceof _rec4._capt(B, 'arguments/0/right'), 'arguments/0'), {

@@ -35,3 +35,3 @@ 'use strict';

var newDi /*: Container*/ = (0, _createContainer.createContainer)([(0, _configurations.factory)(myFn)]);
var newDi /*: Container*/ = (0, _createContainer.createContainer)([[myFn, (0, _configurations.factory)()]]);
newDi.get(myFn);

@@ -53,3 +53,3 @@ newDi.get(myFn);

};
var newDi /*: Container*/ = (0, _createContainer.createContainer)([(0, _configurations.factory)(A)]);
var newDi /*: Container*/ = (0, _createContainer.createContainer)([[A, (0, _configurations.factory)()]]);
(0, _powerAssert2.default)(_rec2._expr(_rec2._capt(_rec2._capt(_rec2._capt(newDi, 'arguments/0/left/callee/object').getProvider(_rec2._capt(A, 'arguments/0/left/arguments/0')), 'arguments/0/left') === _rec2._capt(_rec2._capt(newDi, 'arguments/0/right/callee/object').getProvider(_rec2._capt(A, 'arguments/0/right/arguments/0')), 'arguments/0/right'), 'arguments/0'), {

@@ -56,0 +56,0 @@ content: 'assert(newDi.getProvider(A) === newDi.getProvider(A))',

@@ -37,3 +37,3 @@ 'use strict';

var newDi /*: Container*/ = (0, _createContainer.createContainer)([(0, _configurations.factory)(myFn)]);
var newDi /*: Container*/ = (0, _createContainer.createContainer)([[myFn, (0, _configurations.factory)()]]);

@@ -65,3 +65,3 @@ var result = newDi.get(myFn);

var newDi /*: Container*/ = (0, _createContainer.createContainer)([(0, _configurations.value)(MyValue, 2), (0, _configurations.factory)(myFn, MyValue)]);
var newDi /*: Container*/ = (0, _createContainer.createContainer)([[MyValue, (0, _configurations.value)(2)], [myFn, (0, _configurations.factory)(MyValue)]]);

@@ -95,3 +95,3 @@ var result = newDi.get(myFn);

var newDi /*: Container*/ = (0, _createContainer.createContainer)([(0, _configurations.value)(MyValue, { a: 1, b: 2 }), (0, _configurations.factory)(myFn, MyValue)]);
var newDi /*: Container*/ = (0, _createContainer.createContainer)([[MyValue, (0, _configurations.value)({ a: 1, b: 2 })], [myFn, (0, _configurations.factory)(MyValue)]]);

@@ -123,3 +123,3 @@ var result = newDi.get(myFn);

var newDi /*: Container*/ = (0, _createContainer.createContainer)([(0, _configurations.value)(MyValue, '123'), (0, _configurations.klass)(MyClass, MyValue)]);
var newDi /*: Container*/ = (0, _createContainer.createContainer)([[MyValue, (0, _configurations.value)('123')], [MyClass, (0, _configurations.klass)(MyValue)]]);
var result = newDi.get(MyClass);

@@ -150,3 +150,3 @@ (0, _powerAssert2.default)(_rec7._expr(_rec7._capt(_rec7._capt(result, 'arguments/0/left') instanceof _rec7._capt(MyClass, 'arguments/0/right'), 'arguments/0'), {

var newDi /*: Container*/ = (0, _createContainer.createContainer)([(0, _configurations.value)(MyValue, 2), (0, _configurations.compose)(myFn, MyValue)]);
var newDi /*: Container*/ = (0, _createContainer.createContainer)([[MyValue, (0, _configurations.value)(2)], [myFn, (0, _configurations.compose)(MyValue)]]);

@@ -153,0 +153,0 @@ var result = newDi.get(myFn);

@@ -44,3 +44,3 @@ 'use strict';

var newDi /*: Container*/ = (0, _createContainer.createContainer)([(0, _configurations.value)(MyValue, 2), (0, _configurations.compose)(myFn, MyValue), (0, _configurations.compose)(myFnMiddleware)], [[myFnMiddleware, [myFn]]]);
var newDi /*: Container*/ = (0, _createContainer.createContainer)([[MyValue, (0, _configurations.value)(2)], [myFn, (0, _configurations.compose)(MyValue)], [myFnMiddleware, (0, _configurations.compose)()]], [[myFnMiddleware, [myFn]]]);

@@ -92,3 +92,3 @@ var result = newDi.get(myFn);

var newDi /*: Container*/ = (0, _createContainer.createContainer)([(0, _configurations.klass)(MyClass), (0, _configurations.klass)(MyClassMiddleware)], [[MyClassMiddleware, [MyClass]]]);
var newDi /*: Container*/ = (0, _createContainer.createContainer)([[MyClass, (0, _configurations.klass)()], [MyClassMiddleware, (0, _configurations.klass)()]], [[MyClassMiddleware, [MyClass]]]);
var testMethod = _sinon2.default.spy();

@@ -127,3 +127,3 @@ newDi.get(MyClassMiddleware).test = testMethod;

var newDi /*: Container*/ = (0, _createContainer.createContainer)([(0, _configurations.value)(MyValue, 2), (0, _configurations.tag)((0, _configurations.compose)(myFn, MyValue), 'mytag'), (0, _configurations.compose)(myFnMiddleware)], [[myFnMiddleware, ['mytag']]]);
var newDi /*: Container*/ = (0, _createContainer.createContainer)([[MyValue, (0, _configurations.value)(2)], [myFn, (0, _configurations.tag)((0, _configurations.compose)(MyValue), 'mytag')], [myFnMiddleware, (0, _configurations.compose)()]], [[myFnMiddleware, ['mytag']]]);

@@ -130,0 +130,0 @@ var result = newDi.get(myFn);

@@ -38,3 +38,3 @@ 'use strict';

var di /*: Container*/ = (0, _createContainer.createContainer)([(0, _configurations.factory)(A), (0, _configurations.factory)(B, A)], [], true);
var di /*: Container*/ = (0, _createContainer.createContainer)([[A, (0, _configurations.factory)()], [B, (0, _configurations.factory)(A)]], [], true);

@@ -68,3 +68,3 @@ var result = di.getProvider(B).dependencies.map(depName);

var di /*: Container*/ = (0, _createContainer.createContainer)([(0, _configurations.factory)(A), (0, _configurations.factory)(C, A), (0, _configurations.factory)(B, C)], [], true);
var di /*: Container*/ = (0, _createContainer.createContainer)([[A, (0, _configurations.factory)(A)], [C, (0, _configurations.factory)(A)], [B, (0, _configurations.factory)(C)]], [], true);

@@ -99,3 +99,3 @@ di.getProvider(C);

};
var di /*: Container*/ = (0, _createContainer.createContainer)([(0, _configurations.factory)(A), (0, _configurations.factory)(C, A), (0, _configurations.factory)(B, C, A)], [], true);
var di /*: Container*/ = (0, _createContainer.createContainer)([[A, (0, _configurations.factory)()], [C, (0, _configurations.factory)(A)], [B, (0, _configurations.factory)(C, A)]], [], true);

@@ -128,3 +128,3 @@ var result = di.getProvider(B).dependencies.map(depName);

};
var di /*: Container*/ = (0, _createContainer.createContainer)([(0, _configurations.factory)(A), (0, _configurations.factory)(C, A), (0, _configurations.factory)(B, C)], [], true);
var di /*: Container*/ = (0, _createContainer.createContainer)([[A, (0, _configurations.factory)()], [C, (0, _configurations.factory)(A)], [B, (0, _configurations.factory)(C)]], [], true);

@@ -131,0 +131,0 @@ var result = di.getProvider(B).dependencies.map(depName);

@@ -50,25 +50,17 @@ 'use strict';

var target /*: ?Dependency*/ = void 0;
if (Array.isArray(conf)) {
key = conf[0];
conf = conf[1];
}
if ((typeof conf === 'undefined' ? 'undefined' : _typeof(conf)) === 'object') {
raw = conf;
target = raw.target;
} else if (typeof conf === 'function') {
raw = conf[1];
} else {
key = (conf /*: any*/);
raw = driver.get(conf);
target = conf;
}
if (!raw) {
throw new Error('Can\'t find annotation: ' + conf);
}
if (!target) {
if (!key) {
throw new Error('Can\'t find annotation target: ' + raw.kind);
}
target = raw.target || key;
key = key || (target /*: DependencyKey*/);
var oldAnnotation /*: ?Annotation*/ = map.get(key);

@@ -84,3 +76,3 @@ if (oldAnnotation) {

var deps /*: Array<DepItem>*/ = raw.deps || [];
if (!deps.length && typeof target !== 'string') {
if (!deps.length && typeof target === 'function' || (typeof target === 'undefined' ? 'undefined' : _typeof(target)) === 'object') {
deps = this._paramtypes.get(target) || [];

@@ -87,0 +79,0 @@ }

@@ -14,6 +14,5 @@ 'use strict';

} from 'reactive-di'*/
function alias(target /*: Dependency*/, aliasTarget /*: DependencyKey*/) /*: RawAnnotation*/ {
function alias(aliasTarget /*: DependencyKey*/) /*: RawAnnotation*/ {
return {
kind: 'alias',
target: target,
alias: aliasTarget

@@ -20,0 +19,0 @@ };

@@ -10,9 +10,8 @@ 'use strict';

/*:: import type {
Dependency,
DepItem,
RawAnnotation
} from 'reactive-di'*/
function klass(target /*: Dependency*/) /*: RawAnnotation*/ {
for (var _len = arguments.length, deps = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
deps[_key - 1] = arguments[_key];
function klass() /*: RawAnnotation*/ {
for (var _len = arguments.length, deps = Array(_len), _key = 0; _key < _len; _key++) {
deps[_key] = arguments[_key];
}

@@ -22,3 +21,2 @@

kind: 'klass',
target: target,
deps: deps

@@ -25,0 +23,0 @@ };

@@ -13,5 +13,5 @@ 'use strict';

} from 'reactive-di'*/
function compose(target /*: Function*/) /*: RawAnnotation*/ {
for (var _len = arguments.length, deps = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
deps[_key - 1] = arguments[_key];
function compose() /*: RawAnnotation*/ {
for (var _len = arguments.length, deps = Array(_len), _key = 0; _key < _len; _key++) {
deps[_key] = arguments[_key];
}

@@ -21,3 +21,2 @@

kind: 'compose',
target: target,
deps: deps

@@ -24,0 +23,0 @@ };

@@ -13,5 +13,5 @@ 'use strict';

} from 'reactive-di'*/
function factory(target /*: Function*/) /*: RawAnnotation*/ {
for (var _len = arguments.length, deps = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
deps[_key - 1] = arguments[_key];
function factory() /*: RawAnnotation*/ {
for (var _len = arguments.length, deps = Array(_len), _key = 0; _key < _len; _key++) {
deps[_key] = arguments[_key];
}

@@ -21,3 +21,2 @@

kind: 'factory',
target: target,
deps: deps

@@ -24,0 +23,0 @@ };

@@ -13,6 +13,5 @@ 'use strict';

} from 'reactive-di'*/
function value(target /*: Dependency*/, val /*: any*/) /*: RawAnnotation*/ {
function value(val /*: any*/) /*: RawAnnotation*/ {
return {
kind: 'value',
target: target,
value: val

@@ -19,0 +18,0 @@ };

@@ -50,4 +50,4 @@ 'use strict';

var b = {};
(0, _powerAssert2.default)(_rec3._expr(_rec3._capt(_rec3._capt((0, _getFunctionName2.default)(_rec3._capt(b, 'arguments/0/left/arguments/0')), 'arguments/0/left') === '', 'arguments/0'), {
content: 'assert(getFunctionName(b) === \'\')',
(0, _powerAssert2.default)(_rec3._expr(_rec3._capt(_rec3._capt((0, _getFunctionName2.default)(_rec3._capt(b, 'arguments/0/left/arguments/0')), 'arguments/0/left') === 'Object { }', 'arguments/0'), {
content: 'assert(getFunctionName(b) === \'Object { }\')',
filepath: 'src/utils/__tests__/getFunctionNameTest.js',

@@ -62,4 +62,4 @@ line: 22

var b = { aa: 123, bb: 1 };
(0, _powerAssert2.default)(_rec4._expr(_rec4._capt(_rec4._capt((0, _getFunctionName2.default)(_rec4._capt(b, 'arguments/0/left/arguments/0')), 'arguments/0/left') === 'aa,bb', 'arguments/0'), {
content: 'assert(getFunctionName(b) === \'aa,bb\')',
(0, _powerAssert2.default)(_rec4._expr(_rec4._capt(_rec4._capt((0, _getFunctionName2.default)(_rec4._capt(b, 'arguments/0/left/arguments/0')), 'arguments/0/left') === 'Object { aa: 123, bb: 1 }', 'arguments/0'), {
content: 'assert(getFunctionName(b) === \'Object { aa: 123, bb: 1 }\')',
filepath: 'src/utils/__tests__/getFunctionNameTest.js',

@@ -66,0 +66,0 @@ line: 27

@@ -13,2 +13,10 @@ 'use strict';

function propToStr(prop /*: mixed*/) /*: string*/ {
if ((typeof prop === 'undefined' ? 'undefined' : _typeof(prop)) === 'object' || typeof prop === 'function') {
return String(prop);
}
return String(prop);
}
function getFunctionName(func /*: ?Function|string|number|Object*/) /*: string*/ {

@@ -25,3 +33,5 @@ if (func === null || (typeof func === 'undefined' ? 'undefined' : _typeof(func)) !== 'object' && typeof func !== 'function') {

if (fn === Object) {
return Object.keys(func).join(',');
return 'Object { ' + Object.keys(func).map(function (key) {
return key + ': ' + propToStr((func /*: any*/)[key]);
}).join(', ') + ' }';
}

@@ -28,0 +38,0 @@

@@ -12,8 +12,8 @@ /* @flow */

declare module 'reactive-di/configurations' {
declare function alias(target: Dependency, aliasTarget: DependencyKey): RawAnnotation;
declare function klass(arget: Dependency, ...deps: Array<DepItem>): RawAnnotation;
declare function compose(target: Function, ...deps: Array<DepItem>): RawAnnotation;
declare function factory(target: Function, ...deps: Array<DepItem>): RawAnnotation;
declare function alias(aliasTarget: DependencyKey): RawAnnotation;
declare function klass(...deps: Array<DepItem>): RawAnnotation;
declare function compose(...deps: Array<DepItem>): RawAnnotation;
declare function factory(...deps: Array<DepItem>): RawAnnotation;
declare function tag(annotation: RawAnnotation, ...tags: Array<Tag>): RawAnnotation;
declare function value(target: Dependency, val?: any): RawAnnotation;
declare function value(val?: any): RawAnnotation;
}

@@ -26,3 +26,2 @@ /* @flow */

kind: any;
target?: Dependency;
tags?: Array<Tag>;

@@ -33,3 +32,2 @@ deps?: Array<DepItem>;

declare type ConfigItem =
RawAnnotation
| [DependencyKey, RawAnnotation]

@@ -36,0 +34,0 @@ | Dependency;

{
"name": "reactive-di",
"version": "1.1.10",
"version": "1.1.11",
"description": "Reactive dependency injection",

@@ -5,0 +5,0 @@ "publishConfig": {

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

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

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