Socket
Socket
Sign inDemoInstall

huject

Package Overview
Dependencies
2
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.3.3 to 1.3.4

3

Changelog.md

@@ -0,1 +1,4 @@

# Version 1.3.4
Fixed issue #1
# Version 1.3

@@ -2,0 +5,0 @@ Possibility to inject ContainerFactoryInterface to access to container and create objects dynamically

@@ -0,1 +1,3 @@

"use strict";
import {DeepService} from './DeepService';

@@ -2,0 +4,0 @@ import {FirstService} from './FirstService';

@@ -0,1 +1,3 @@

"use strict";
export class DeepService {

@@ -2,0 +4,0 @@ private sayString: string = "I'm Deep Service, i have default say string";

@@ -0,1 +1,3 @@

"use strict";
import {ServiceInterface} from './ServiceInterface';

@@ -2,0 +4,0 @@

@@ -0,1 +1,3 @@

"use strict";
import container from './bootstrap';

@@ -2,0 +4,0 @@ import {ServiceInterface} from './ServiceInterface';

@@ -0,1 +1,3 @@

"use strict";
import {DeepService} from './DeepService';

@@ -2,0 +4,0 @@ import {Inject} from '../src/index'

@@ -0,1 +1,3 @@

"use strict";
export class ServiceInterface {

@@ -2,0 +4,0 @@ public say(): string {

16

package.json
{
"name": "huject",
"version": "1.3.3",
"version": "1.3.4",
"description": "Typescript dependency injection container for humans",

@@ -28,16 +28,16 @@ "main": "./src/index.js",

"devDependencies": {
"chai": "^3.2.0",
"chai": "^3.4.1",
"grunt": "^0.4.5",
"grunt-mocha-test": "^0.12.7",
"grunt-ts": "^5.0.0-beta.1",
"mocha": "^2.2.5",
"sinon": "^1.16.1",
"grunt-ts": "^5.3.0-beta.2",
"mocha": "^2.3.4",
"sinon": "^1.17.2",
"sinon-chai": "^2.8.0",
"source-map-support": "^0.3.2",
"typescript": "^1.6.0-beta"
"source-map-support": "^0.4.0",
"typescript": "^1.7.3"
},
"dependencies": {
"es6-collections": "^0.5.5",
"reflect-metadata": "^0.1.0"
"reflect-metadata": "^0.1.2"
}
}

@@ -1,3 +0,1 @@

/// <reference path="../typings/tsd.d.ts" />
/// <reference path="../node_modules/reflect-metadata/reflect-metadata.d.ts" />
var definition_1 = require('./definition');

@@ -4,0 +2,0 @@ var resolver_1 = require("./resolver");

@@ -1,4 +0,1 @@

/// <reference path="../typings/tsd.d.ts" />
/// <reference path="../node_modules/reflect-metadata/reflect-metadata.d.ts" />
import {Definition, FactoryMethod, DefinitionObjectType} from './definition';

@@ -5,0 +2,0 @@ import {ContainerResolver} from "./resolver";

@@ -1,3 +0,1 @@

/// <reference path="../typings/tsd.d.ts" />
/// <reference path="../node_modules/reflect-metadata/reflect-metadata.d.ts" />
require('reflect-metadata');

@@ -4,0 +2,0 @@ /**

@@ -1,4 +0,1 @@

/// <reference path="../typings/tsd.d.ts" />
/// <reference path="../node_modules/reflect-metadata/reflect-metadata.d.ts" />
import 'reflect-metadata';

@@ -5,0 +2,0 @@

@@ -1,2 +0,1 @@

/// <reference path="../typings/tsd.d.ts" />
(function (FactoryMethod) {

@@ -3,0 +2,0 @@ FactoryMethod[FactoryMethod["SINGLETON"] = 0] = "SINGLETON";

@@ -1,3 +0,1 @@

/// <reference path="../typings/tsd.d.ts" />
export enum FactoryMethod {

@@ -4,0 +2,0 @@ SINGLETON,

@@ -61,3 +61,12 @@ require('es6-collections');

}
var constructor = this.resolveDefinition(internalDefinition, constructorArgs, strict);
var constructor = this.resolveDefinition(internalDefinition);
var constructorArguments = [];
if (internalDefinition.definitionObjectType !== definition_2.DefinitionObjectType.CALLABLE && internalDefinition.method !== definition_2.FactoryMethod.OBJECT) {
if (typeof constructorArgs !== 'undefined' && constructorArgs.length > 0) {
constructorArguments = constructorArgs;
}
else {
constructorArguments = this.resolveConstructorArguments(internalDefinition, constructor, strict);
}
}
var resolveMethod = internalDefinition.method;

@@ -74,3 +83,3 @@ if (typeof method !== "undefined" && internalDefinition.method != definition_2.FactoryMethod.OBJECT) {

else {
var obj = new constructor();
var obj = new (constructor.bind.apply(constructor, [void 0].concat(constructorArguments)))();
this.resolveProperties(obj, strict);

@@ -87,3 +96,3 @@ this.singletonObjects.set(internalDefinition, obj);

else {
var obj = new constructor();
var obj = new (constructor.bind.apply(constructor, [void 0].concat(constructorArguments)))();
this.resolveProperties(obj, strict);

@@ -102,56 +111,8 @@ return obj;

* @param definition
* @param constructorArgs
* @param strict
*/
ContainerResolver.prototype.resolveDefinition = function (definition, constructorArgs, strict) {
if (strict === void 0) { strict = true; }
ContainerResolver.prototype.resolveDefinition = function (definition) {
if (definition.definitionObjectType == definition_2.DefinitionObjectType.CALLABLE || definition.method == definition_2.FactoryMethod.OBJECT) {
return definition.definitionConstructor;
}
var constructor = this.resolveConstructor(definition);
var constructorArguments = [];
if (typeof constructorArgs !== 'undefined' && constructorArgs.length > 0) {
constructorArguments = constructorArgs;
}
else if (Reflect.hasOwnMetadata("inject:constructor", constructor)) {
// Resolve constructor dependencies
var dependencies = Reflect.getOwnMetadata("design:paramtypes", constructor);
var resolvedDeps = [];
if (dependencies) {
for (var i = 0; i < dependencies.length; i++) {
var dep = dependencies[i];
var method = Reflect.getOwnMetadata('inject:constructor:param' + i + ':method', constructor);
// Use literal for resolving if specified
if (Reflect.hasOwnMetadata('inject:constructor:param' + i + ':literal', constructor)) {
dep = Reflect.getOwnMetadata('inject:constructor:param' + i + ':literal', constructor);
}
var resolvedDep = void 0;
try {
resolvedDep = this.resolve(dep, method, undefined, strict);
}
catch (e) {
if (Reflect.hasOwnMetadata('inject:constructor:param' + i + ':optional', constructor)) {
resolvedDep = null;
}
else {
throw e;
}
}
resolvedDeps.push(resolvedDep);
}
}
constructorArguments = resolvedDeps;
}
else {
// No constructor injection, lookup for constructor arguments in definition
constructorArguments = this.resolveConstructorArguments(definition);
if (!constructorArguments) {
constructorArguments = [];
}
}
var newConstructor = function () {
constructor.apply(this, constructorArguments);
};
newConstructor.prototype = constructor.prototype;
return newConstructor;
return this.resolveConstructor(definition);
};

@@ -204,2 +165,49 @@ /**

/**
* Resolves constructor arguments from constructor injection or definition chain
* @param definition
* @param constructor
* @param strict
*/
ContainerResolver.prototype.resolveConstructorArguments = function (definition, constructor, strict) {
if (strict === void 0) { strict = true; }
var constructorArguments = [];
if (Reflect.hasOwnMetadata("inject:constructor", constructor)) {
// Resolve constructor dependencies
var dependencies = Reflect.getOwnMetadata("design:paramtypes", constructor);
var resolvedDeps = [];
if (dependencies) {
for (var i = 0; i < dependencies.length; i++) {
var dep = dependencies[i];
var method = Reflect.getOwnMetadata('inject:constructor:param' + i + ':method', constructor);
// Use literal for resolving if specified
if (Reflect.hasOwnMetadata('inject:constructor:param' + i + ':literal', constructor)) {
dep = Reflect.getOwnMetadata('inject:constructor:param' + i + ':literal', constructor);
}
var resolvedDep = void 0;
try {
resolvedDep = this.resolve(dep, method, undefined, strict);
}
catch (e) {
if (Reflect.hasOwnMetadata('inject:constructor:param' + i + ':optional', constructor)) {
resolvedDep = null;
}
else {
throw e;
}
}
resolvedDeps.push(resolvedDep);
}
}
constructorArguments = resolvedDeps;
}
else {
// No constructor injection, lookup for constructor arguments in definition
constructorArguments = this.resolveConstructorArgumentsFromDefinition(definition);
if (!constructorArguments) {
constructorArguments = [];
}
}
return constructorArguments;
};
/**
* Resolves constructor arguments from definition chain

@@ -210,6 +218,6 @@ * @private

*/
ContainerResolver.prototype.resolveConstructorArguments = function (definition) {
ContainerResolver.prototype.resolveConstructorArgumentsFromDefinition = function (definition) {
var constructorArgs = definition.constructorArgs;
if (!constructorArgs && this.definitions.has(definition.definitionConstructor) && (definition.definitionConstructor != definition.key)) {
constructorArgs = this.resolveConstructorArguments(this.definitions.get(definition.definitionConstructor));
constructorArgs = this.resolveConstructorArgumentsFromDefinition(this.definitions.get(definition.definitionConstructor));
}

@@ -216,0 +224,0 @@ return constructorArgs;

@@ -5,4 +5,2 @@ import 'es6-collections';

import {FactoryMethod, DefinitionObjectType} from './definition';
import {FunctionDeclaration} from "typescript";
import {DefinitionInfo} from "typescript";
import {FactoryAutoProxy} from "./factoryautoproxy";

@@ -66,3 +64,3 @@

public resolve(definition: string|Function, method?: FactoryMethod, constructorArgs?: Array<any>, strict = true): any {
let internalDefinition = null;
let internalDefinition: Definition = null;
// bind autofactories to factory auto proxy instance

@@ -84,4 +82,14 @@ if (typeof definition === "function" && Reflect.hasOwnMetadata("inject:autofactory", definition)) {

let constructor = this.resolveDefinition(internalDefinition, constructorArgs, strict);
let constructor = this.resolveDefinition(internalDefinition);
let constructorArguments = [];
if (internalDefinition.definitionObjectType !== DefinitionObjectType.CALLABLE && internalDefinition.method !== FactoryMethod.OBJECT) {
if (typeof constructorArgs !== 'undefined' && constructorArgs.length > 0) {
constructorArguments = constructorArgs;
} else {
constructorArguments = this.resolveConstructorArguments(internalDefinition, constructor, strict);
}
}
let resolveMethod = internalDefinition.method;

@@ -98,3 +106,3 @@ if (typeof method !== "undefined" && internalDefinition.method != FactoryMethod.OBJECT) {

} else {
let obj = new constructor();
let obj = new constructor(...constructorArguments);
this.resolveProperties(obj, strict);

@@ -110,3 +118,3 @@ this.singletonObjects.set(internalDefinition, obj);

} else {
let obj = new constructor();
let obj = new constructor(...constructorArguments);
this.resolveProperties(obj, strict);

@@ -126,56 +134,8 @@ return obj;

* @param definition
* @param constructorArgs
* @param strict
*/
private resolveDefinition(definition: Definition, constructorArgs?: Array<any>, strict = true): any {
private resolveDefinition(definition: Definition): any {
if (definition.definitionObjectType == DefinitionObjectType.CALLABLE || definition.method == FactoryMethod.OBJECT) {
return definition.definitionConstructor;
}
let constructor = this.resolveConstructor(definition);
let constructorArguments = [];
if (typeof constructorArgs !== 'undefined' && constructorArgs.length > 0) {
constructorArguments = constructorArgs;
} else if (Reflect.hasOwnMetadata("inject:constructor", constructor)) {
// Resolve constructor dependencies
let dependencies = Reflect.getOwnMetadata("design:paramtypes", constructor);
let resolvedDeps = [];
if (dependencies) {
for (let i = 0; i < dependencies.length; i++) {
let dep = dependencies[i];
let method = Reflect.getOwnMetadata('inject:constructor:param' + i + ':method', constructor);
// Use literal for resolving if specified
if (Reflect.hasOwnMetadata('inject:constructor:param' + i + ':literal', constructor)) {
dep = Reflect.getOwnMetadata('inject:constructor:param' + i + ':literal', constructor);
}
let resolvedDep;
try {
resolvedDep = this.resolve(dep, method, undefined, strict);
} catch (e) {
if (Reflect.hasOwnMetadata('inject:constructor:param' + i + ':optional', constructor)) {
resolvedDep = null;
} else {
throw e;
}
}
resolvedDeps.push(resolvedDep);
}
}
constructorArguments = resolvedDeps;
} else {
// No constructor injection, lookup for constructor arguments in definition
constructorArguments = this.resolveConstructorArguments(definition);
if (!constructorArguments) {
constructorArguments = [];
}
}
let newConstructor = function () {
constructor.apply(this, constructorArguments);
};
newConstructor.prototype = constructor.prototype;
return newConstructor;
return this.resolveConstructor(definition);
}

@@ -229,2 +189,48 @@

/**
* Resolves constructor arguments from constructor injection or definition chain
* @param definition
* @param constructor
* @param strict
*/
private resolveConstructorArguments(definition: Definition, constructor: Function, strict = true): Array<any> {
let constructorArguments = [];
if (Reflect.hasOwnMetadata("inject:constructor", constructor)) {
// Resolve constructor dependencies
let dependencies = Reflect.getOwnMetadata("design:paramtypes", constructor);
let resolvedDeps = [];
if (dependencies) {
for (let i = 0; i < dependencies.length; i++) {
let dep = dependencies[i];
let method = Reflect.getOwnMetadata('inject:constructor:param' + i + ':method', constructor);
// Use literal for resolving if specified
if (Reflect.hasOwnMetadata('inject:constructor:param' + i + ':literal', constructor)) {
dep = Reflect.getOwnMetadata('inject:constructor:param' + i + ':literal', constructor);
}
let resolvedDep;
try {
resolvedDep = this.resolve(dep, method, undefined, strict);
} catch (e) {
if (Reflect.hasOwnMetadata('inject:constructor:param' + i + ':optional', constructor)) {
resolvedDep = null;
} else {
throw e;
}
}
resolvedDeps.push(resolvedDep);
}
}
constructorArguments = resolvedDeps;
} else {
// No constructor injection, lookup for constructor arguments in definition
constructorArguments = this.resolveConstructorArgumentsFromDefinition(definition);
if (!constructorArguments) {
constructorArguments = [];
}
}
return constructorArguments;
}
/**
* Resolves constructor arguments from definition chain

@@ -235,6 +241,6 @@ * @private

*/
private resolveConstructorArguments(definition: Definition): Array<any> {
private resolveConstructorArgumentsFromDefinition(definition: Definition): Array<any> {
let constructorArgs = definition.constructorArgs;
if (!constructorArgs && this.definitions.has(definition.definitionConstructor) && (definition.definitionConstructor != definition.key)) {
constructorArgs = this.resolveConstructorArguments(this.definitions.get(definition.definitionConstructor));
constructorArgs = this.resolveConstructorArgumentsFromDefinition(this.definitions.get(definition.definitionConstructor));
}

@@ -241,0 +247,0 @@ return constructorArgs;

@@ -7,8 +7,6 @@ var __extends = (this && this.__extends) || function (d, b) {

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc);
switch (arguments.length) {
case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
}
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};

@@ -37,9 +35,8 @@ var __metadata = (this && this.__metadata) || function (k, v) {

;
Object.defineProperty(TestFactory.prototype, "createObject",
__decorate([
decorators_1.Factory,
__metadata('design:type', Function),
__metadata('design:paramtypes', []),
__metadata('design:returntype', Model)
], TestFactory.prototype, "createObject", Object.getOwnPropertyDescriptor(TestFactory.prototype, "createObject")));
__decorate([
decorators_1.Factory,
__metadata('design:type', Function),
__metadata('design:paramtypes', []),
__metadata('design:returntype', Model)
], TestFactory.prototype, "createObject", null);
TestFactory = __decorate([

@@ -57,9 +54,8 @@ decorators_1.Factory,

SecondFactory.prototype.createSecond = function (num) { return null; };
Object.defineProperty(SecondFactory.prototype, "createSecond",
__decorate([
decorators_1.Factory,
__metadata('design:type', Function),
__metadata('design:paramtypes', [Number]),
__metadata('design:returntype', Model)
], SecondFactory.prototype, "createSecond", Object.getOwnPropertyDescriptor(SecondFactory.prototype, "createSecond")));
__decorate([
decorators_1.Factory,
__metadata('design:type', Function),
__metadata('design:paramtypes', [Number]),
__metadata('design:returntype', Model)
], SecondFactory.prototype, "createSecond", null);
SecondFactory = __decorate([

@@ -75,9 +71,8 @@ decorators_1.Factory,

InvalidFactory.prototype.invalidMethod = function () { return null; };
Object.defineProperty(InvalidFactory.prototype, "invalidMethod",
__decorate([
decorators_1.Factory,
__metadata('design:type', Function),
__metadata('design:paramtypes', []),
__metadata('design:returntype', String)
], InvalidFactory.prototype, "invalidMethod", Object.getOwnPropertyDescriptor(InvalidFactory.prototype, "invalidMethod")));
__decorate([
decorators_1.Factory,
__metadata('design:type', Function),
__metadata('design:paramtypes', []),
__metadata('design:returntype', String)
], InvalidFactory.prototype, "invalidMethod", null);
InvalidFactory = __decorate([

@@ -95,7 +90,7 @@ decorators_1.Factory,

__metadata('design:type', TestFactory)
], Service.prototype, "factory");
], Service.prototype, "factory", void 0);
__decorate([
decorators_1.Inject,
__metadata('design:type', SecondFactory)
], Service.prototype, "second");
], Service.prototype, "second", void 0);
return Service;

@@ -109,3 +104,3 @@ })();

__metadata('design:type', InvalidFactory)
], ErrorService.prototype, "factory");
], ErrorService.prototype, "factory", void 0);
return ErrorService;

@@ -112,0 +107,0 @@ })();

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc);
switch (arguments.length) {
case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
}
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};

@@ -38,3 +36,3 @@ var __metadata = (this && this.__metadata) || function (k, v) {

__metadata('design:type', DeepService)
], AnotherService.prototype, "deepService");
], AnotherService.prototype, "deepService", void 0);
return AnotherService;

@@ -51,3 +49,3 @@ })();

__metadata('design:type', AnotherService)
], TestImplementationWithParamInject.prototype, "service");
], TestImplementationWithParamInject.prototype, "service", void 0);
return TestImplementationWithParamInject;

@@ -103,11 +101,11 @@ })();

__metadata('design:type', Number)
], InjectWithStringDefinition.prototype, "num");
], InjectWithStringDefinition.prototype, "num", void 0);
__decorate([
decorators_1.Inject('coolstring'),
__metadata('design:type', String)
], InjectWithStringDefinition.prototype, "str");
], InjectWithStringDefinition.prototype, "str", void 0);
__decorate([
decorators_1.Inject('service', definition_1.FactoryMethod.SINGLETON),
__metadata('design:type', DeepService)
], InjectWithStringDefinition.prototype, "service");
], InjectWithStringDefinition.prototype, "service", void 0);
return InjectWithStringDefinition;

@@ -121,7 +119,7 @@ })();

__metadata('design:type', Number)
], InjectWithStringDefinitionWrong.prototype, "num");
], InjectWithStringDefinitionWrong.prototype, "num", void 0);
__decorate([
decorators_1.Inject('wrongstring'),
__metadata('design:type', String)
], InjectWithStringDefinitionWrong.prototype, "str");
], InjectWithStringDefinitionWrong.prototype, "str", void 0);
return InjectWithStringDefinitionWrong;

@@ -135,7 +133,7 @@ })();

__metadata('design:type', PropertyInjectionTest1)
], ControllerWithPropertyInjection.prototype, "injection1");
], ControllerWithPropertyInjection.prototype, "injection1", void 0);
__decorate([
decorators_1.Inject(definition_1.FactoryMethod.SINGLETON),
__metadata('design:type', PropertyInjectionTest2)
], ControllerWithPropertyInjection.prototype, "injection2");
], ControllerWithPropertyInjection.prototype, "injection2", void 0);
return ControllerWithPropertyInjection;

@@ -149,7 +147,7 @@ })();

__metadata('design:type', PropertyInjectionTest1)
], SecondControllerWithPropertyInjection.prototype, "injection1");
], SecondControllerWithPropertyInjection.prototype, "injection1", void 0);
__decorate([
decorators_1.Inject,
__metadata('design:type', PropertyInjectionTest2)
], SecondControllerWithPropertyInjection.prototype, "injection2");
], SecondControllerWithPropertyInjection.prototype, "injection2", void 0);
return SecondControllerWithPropertyInjection;

@@ -210,3 +208,3 @@ })();

__metadata('design:type', String)
], PropertyInjectionOptional.prototype, "str");
], PropertyInjectionOptional.prototype, "str", void 0);
__decorate([

@@ -216,3 +214,3 @@ decorators_1.Inject('nonexistnumber'),

__metadata('design:type', Number)
], PropertyInjectionOptional.prototype, "num");
], PropertyInjectionOptional.prototype, "num", void 0);
return PropertyInjectionOptional;

@@ -219,0 +217,0 @@ })();

@@ -9,20 +9,20 @@ {

"mocha/mocha.d.ts": {
"commit": "67605e10f6eb01c9d4a0d13719d804d6dea9e1cb"
"commit": "19b4bf1c7bf2c7feccba05c7b235c1da3971f586"
},
"chai/chai.d.ts": {
"commit": "67605e10f6eb01c9d4a0d13719d804d6dea9e1cb"
"commit": "19b4bf1c7bf2c7feccba05c7b235c1da3971f586"
},
"sinon/sinon.d.ts": {
"commit": "67605e10f6eb01c9d4a0d13719d804d6dea9e1cb"
"commit": "19b4bf1c7bf2c7feccba05c7b235c1da3971f586"
},
"sinon-chai/sinon-chai.d.ts": {
"commit": "67605e10f6eb01c9d4a0d13719d804d6dea9e1cb"
"commit": "19b4bf1c7bf2c7feccba05c7b235c1da3971f586"
},
"node/node.d.ts": {
"commit": "67605e10f6eb01c9d4a0d13719d804d6dea9e1cb"
"commit": "19b4bf1c7bf2c7feccba05c7b235c1da3971f586"
},
"es6-collections/es6-collections.d.ts": {
"commit": "67605e10f6eb01c9d4a0d13719d804d6dea9e1cb"
"commit": "19b4bf1c7bf2c7feccba05c7b235c1da3971f586"
}
}
}

@@ -1,8 +0,11 @@

// Type definitions for chai 2.0.0
// Type definitions for chai 3.2.0
// Project: http://chaijs.com/
// Definitions by: Jed Mao <https://github.com/jedmao/>,
// Bart van der Schoor <https://github.com/Bartvds>,
// Andrew Brown <https://github.com/AGBrown>
// Andrew Brown <https://github.com/AGBrown>,
// Olivier Chevet <https://github.com/olivr70>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
// <reference path="../assertion-error/assertion-error.d.ts"/>
declare module Chai {

@@ -19,5 +22,7 @@

config: Config;
AssertionError: typeof AssertionError;
}
export interface ExpectStatic extends AssertionStatic {
fail(actual?: any, expected?: any, message?: string, operator?: string): void;
}

@@ -53,6 +58,10 @@

deep: Deep;
any: KeyFilter;
all: KeyFilter;
a: TypeComparison;
an: TypeComparison;
include: Include;
includes: Include;
contain: Include;
contains: Include;
ok: Assertion;

@@ -63,2 +72,3 @@ true: Assertion;

undefined: Assertion;
NaN: Assertion;
exist: Assertion;

@@ -76,5 +86,8 @@ empty: Assertion;

haveOwnProperty: OwnProperty;
ownPropertyDescriptor: OwnPropertyDescriptor;
haveOwnPropertyDescriptor: OwnPropertyDescriptor;
length: Length;
lengthOf: Length;
match(regexp: RegExp|string, message?: string): Assertion;
match: Match;
matches: Match;
string(string: string, message?: string): Assertion;

@@ -86,7 +99,19 @@ keys: Keys;

Throw: Throw;
respondTo(method: string, message?: string): Assertion;
respondTo: RespondTo;
respondsTo: RespondTo;
itself: Assertion;
satisfy(matcher: Function, message?: string): Assertion;
satisfy: Satisfy;
satisfies: Satisfy;
closeTo(expected: number, delta: number, message?: string): Assertion;
members: Members;
increase: PropertyChange;
increases: PropertyChange;
decrease: PropertyChange;
decreases: PropertyChange;
change: PropertyChange;
changes: PropertyChange;
extensible: Assertion;
sealed: Assertion;
frozen: Assertion;
}

@@ -142,4 +167,9 @@

property: Property;
members: Members;
}
interface KeyFilter {
keys: Keys;
}
interface Equal {

@@ -157,2 +187,7 @@ (value: any, message?: string): Assertion;

interface OwnPropertyDescriptor {
(name: string, descriptor: PropertyDescriptor, message?: string): Assertion;
(name: string, message?: string): Assertion;
}
interface Length extends LanguageChains, NumericComparison {

@@ -168,7 +203,14 @@ (length: number, message?: string): Assertion;

members: Members;
any: KeyFilter;
all: KeyFilter;
}
interface Match {
(regexp: RegExp|string, message?: string): Assertion;
}
interface Keys {
(...keys: string[]): Assertion;
(keys: any[]): Assertion;
(keys: Object): Assertion;
}

@@ -186,2 +228,10 @@

interface RespondTo {
(method: string, message?: string): Assertion;
}
interface Satisfy {
(matcher: Function, message?: string): Assertion;
}
interface Members {

@@ -191,2 +241,6 @@ (set: any[], message?: string): Assertion;

interface PropertyChange {
(object: Object, prop: string, msg?: string): Assertion;
}
export interface Assert {

@@ -202,3 +256,5 @@ /**

ok(val: any, msg?: string): void;
isOk(val: any, msg?: string): void;
notOk(val: any, msg?: string): void;
isNotOk(val: any, msg?: string): void;

@@ -223,2 +279,8 @@ equal(act: any, exp: any, msg?: string): void;

isNaN(val: any, msg?: string): void;
isNotNaN(val: any, msg?: string): void;
isAbove(val: number, abv: number, msg?: string): void;
isBelow(val: number, blw: number, msg?: string): void;
isFunction(val: any, msg?: string): void;

@@ -294,5 +356,23 @@ isNotFunction(val: any, msg?: string): void;

sameMembers(set1: any[], set2: any[], msg?: string): void;
includeMembers(set1: any[], set2: any[], msg?: string): void;
sameDeepMembers(set1: any[], set2: any[], msg?: string): void;
includeMembers(superset: any[], subset: any[], msg?: string): void;
ifError(val: any, msg?: string): void;
isExtensible(obj: {}, msg?: string): void;
extensible(obj: {}, msg?: string): void;
isNotExtensible(obj: {}, msg?: string): void;
notExtensible(obj: {}, msg?: string): void;
isSealed(obj: {}, msg?: string): void;
sealed(obj: {}, msg?: string): void;
isNotSealed(obj: {}, msg?: string): void;
notSealed(obj: {}, msg?: string): void;
isFrozen(obj: Object, msg?: string): void;
frozen(obj: Object, msg?: string): void;
isNotFrozen(obj: Object, msg?: string): void;
notFrozen(obj: Object, msg?: string): void;
}

@@ -299,0 +379,0 @@

@@ -52,2 +52,6 @@ // Type definitions for mocha 2.2.5

declare function before(description: string, action: () => void): void;
declare function before(description: string, action: (done: MochaDone) => void): void;
declare function setup(action: () => void): void;

@@ -61,2 +65,6 @@

declare function after(description: string, action: () => void): void;
declare function after(description: string, action: (done: MochaDone) => void): void;
declare function teardown(action: () => void): void;

@@ -70,2 +78,6 @@

declare function beforeEach(description: string, action: () => void): void;
declare function beforeEach(description: string, action: (done: MochaDone) => void): void;
declare function suiteSetup(action: () => void): void;

@@ -79,2 +91,6 @@

declare function afterEach(description: string, action: () => void): void;
declare function afterEach(description: string, action: (done: MochaDone) => void): void;
declare function suiteTeardown(action: () => void): void;

@@ -107,2 +123,8 @@

checkLeaks(): Mocha;
/**
* Function to allow assertion libraries to throw errors directly into mocha.
* This is useful when running tests in a browser because window.onerror will
* only receive the 'message' attribute of the Error.
*/
throwError(error: Error): void;
/** Enables growl support. */

@@ -109,0 +131,0 @@ growl(): Mocha;

@@ -95,2 +95,3 @@ // Type definitions for Sinon 1.16.0

returnsArg(index: number): SinonStub;
returnsThis(): SinonStub;
throws(type?: string): SinonStub;

@@ -268,2 +269,3 @@ throws(obj: any): SinonStub;

requests: SinonFakeXMLHttpRequest[];
respondImmediately: boolean;

@@ -270,0 +272,0 @@ // Methods

@@ -7,1 +7,3 @@ /// <reference path="chai/chai.d.ts" />

/// <reference path="es6-collections/es6-collections.d.ts" />
/// <reference path="harmony-reflect/harmony-reflect.d.ts" />
/// <reference path="../node_modules/reflect-metadata/reflect-metadata.d.ts" />

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 too big to display

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc