@e22m4u/js-repository 0.1.1 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.cjs +41 -17
- package/.husky/commit-msg +1 -4
- package/.husky/pre-commit +0 -3
- package/.mocharc.cjs +2 -2
- package/README.md +2 -2
- package/docs/assets/main.js +2 -2
- package/docs/assets/navigation.js +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/assets/style.css +35 -15
- package/docs/classes/Adapter.html +19 -19
- package/docs/classes/AdapterLoader.html +8 -8
- package/docs/classes/AdapterRegistry.html +8 -8
- package/docs/classes/BelongsToResolver.html +9 -9
- package/docs/classes/DatasourceDefinitionValidator.html +8 -8
- package/docs/classes/DefinitionRegistry.html +12 -12
- package/docs/classes/FieldsClauseTool.html +10 -10
- package/docs/classes/HasManyResolver.html +10 -10
- package/docs/classes/HasOneResolver.html +10 -10
- package/docs/classes/IncludeClauseTool.html +12 -12
- package/docs/classes/InvalidArgumentError.html +7 -5
- package/docs/classes/InvalidOperatorValueError.html +7 -5
- package/docs/classes/ModelDataSanitizer.html +8 -8
- package/docs/classes/ModelDataValidator.html +9 -9
- package/docs/classes/ModelDefinitionUtils.html +23 -23
- package/docs/classes/ModelDefinitionValidator.html +8 -8
- package/docs/classes/NotImplementedError.html +7 -5
- package/docs/classes/OperatorClauseTool.html +32 -32
- package/docs/classes/OrderClauseTool.html +10 -10
- package/docs/classes/PrimaryKeysDefinitionValidator.html +8 -8
- package/docs/classes/PropertiesDefinitionValidator.html +8 -8
- package/docs/classes/ReferencesManyResolver.html +8 -8
- package/docs/classes/RelationsDefinitionValidator.html +8 -8
- package/docs/classes/Repository.html +28 -24
- package/docs/classes/RepositoryRegistry.html +9 -9
- package/docs/classes/Schema.html +10 -10
- package/docs/classes/SliceClauseTool.html +10 -10
- package/docs/classes/WhereClauseTool.html +9 -9
- package/docs/enums/DataType.html +2 -2
- package/docs/enums/DecoratorTargetType.html +11 -0
- package/docs/enums/RelationType.html +2 -2
- package/docs/functions/capitalize.html +1 -1
- package/docs/functions/cloneDeep.html +2 -2
- package/docs/functions/excludeObjectKeys.html +2 -2
- package/docs/functions/getCtorName.html +1 -1
- package/docs/functions/getDecoratorTargetType.html +2 -0
- package/docs/functions/getValueByPath.html +1 -1
- package/docs/functions/isCtor.html +3 -2
- package/docs/functions/isPureObject.html +1 -1
- package/docs/functions/selectObjectKeys.html +2 -2
- package/docs/functions/singularize.html +1 -1
- package/docs/functions/stringToRegexp.html +2 -2
- package/docs/index.html +3 -3
- package/docs/interfaces/AndClause.html +2 -2
- package/docs/interfaces/Constructor.html +4 -0
- package/docs/interfaces/OrClause.html +2 -2
- package/docs/modules.html +4 -1
- package/docs/types/AnyObject.html +1 -1
- package/docs/types/BelongsToDefinition.html +1 -1
- package/docs/types/DEFAULT_PRIMARY_KEY_PROPERTY_NAME.html +1 -1
- package/docs/types/DatasourceDefinition.html +1 -1
- package/docs/types/FieldsClause.html +1 -1
- package/docs/types/FilterClause.html +1 -1
- package/docs/types/Flatten.html +1 -1
- package/docs/types/FullPropertyDefinition.html +1 -1
- package/docs/types/HasManyDefinition.html +1 -1
- package/docs/types/HasOneDefinition.html +1 -1
- package/docs/types/Identity.html +2 -2
- package/docs/types/IncludeClause.html +1 -1
- package/docs/types/ItemFilterClause.html +2 -2
- package/docs/types/ModelData.html +1 -1
- package/docs/types/ModelDefinition.html +1 -1
- package/docs/types/ModelId.html +1 -1
- package/docs/types/NestedIncludeClause.html +1 -1
- package/docs/types/NormalizedFieldsClause.html +1 -1
- package/docs/types/NormalizedIncludeClause.html +1 -1
- package/docs/types/OperatorClause.html +3 -3
- package/docs/types/OptionalUnlessRequiredId.html +2 -2
- package/docs/types/OrderClause.html +1 -1
- package/docs/types/PartialBy.html +2 -2
- package/docs/types/PartialWithoutId.html +2 -2
- package/docs/types/PolyBelongsToDefinition.html +1 -1
- package/docs/types/PolyHasManyDefinitionWithTargetKeys.html +1 -1
- package/docs/types/PolyHasManyDefinitionWithTargetRelationName.html +1 -1
- package/docs/types/PolyHasOneDefinitionWithTargetKeys.html +1 -1
- package/docs/types/PolyHasOneDefinitionWithTargetRelationName.html +1 -1
- package/docs/types/PropertiesClause.html +3 -3
- package/docs/types/PropertyDefinition.html +1 -1
- package/docs/types/PropertyDefinitionMap.html +1 -1
- package/docs/types/ReferencesManyDefinition.html +1 -1
- package/docs/types/RelationDefinition.html +1 -1
- package/docs/types/RelationDefinitionMap.html +1 -1
- package/docs/types/WhereClause.html +2 -2
- package/docs/types/WithoutId.html +2 -2
- package/mocha.setup.js +8 -3
- package/package.json +23 -19
- package/src/adapter/decorator/data-sanitizing-decorator.d.ts +2 -1
- package/src/adapter/decorator/data-validation-decorator.d.ts +2 -1
- package/src/adapter/decorator/data-validation-decorator.js +18 -10
- package/src/adapter/decorator/data-validation-decorator.spec.js +40 -0
- package/src/adapter/decorator/default-values-decorator.d.ts +2 -1
- package/src/adapter/decorator/fields-filtering-decorator.d.ts +2 -1
- package/src/adapter/decorator/inclusion-decorator.d.ts +2 -1
- package/src/definition/model/index.js +1 -0
- package/src/definition/model/model-data-validator.d.ts +4 -16
- package/src/definition/model/model-data-validator.js +92 -11
- package/src/definition/model/model-data-validator.spec.js +1140 -442
- package/src/definition/model/model-definition.js +1 -0
- package/src/definition/model/properties/index.d.ts +1 -0
- package/src/definition/model/properties/index.js +2 -0
- package/src/definition/model/properties/properties-definition-validator.js +47 -0
- package/src/definition/model/properties/properties-definition-validator.spec.js +50 -0
- package/src/definition/model/properties/property-definition.d.ts +2 -0
- package/src/definition/model/properties/property-definition.js +1 -0
- package/src/definition/model/properties/property-validator/index.d.ts +2 -0
- package/src/definition/model/properties/property-validator/index.js +2 -0
- package/src/definition/model/properties/property-validator/property-validator-registry.d.ts +29 -0
- package/src/definition/model/properties/property-validator/property-validator-registry.js +69 -0
- package/src/definition/model/properties/property-validator/property-validator-registry.spec.js +120 -0
- package/src/definition/model/properties/property-validator/property-validator.d.ts +30 -0
- package/src/definition/model/properties/property-validator/property-validator.js +1 -0
- package/src/definition/model/relations/index.js +1 -0
- package/src/definition/model/relations/relation-definition.js +1 -0
- package/src/filter/filter-clause.d.ts +4 -4
- package/src/index.d.ts +1 -1
- package/src/index.js +1 -0
- package/src/repository/repository.d.ts +9 -3
- package/src/repository/repository.js +0 -1
- package/src/schema.d.ts +10 -1
- package/src/schema.js +13 -0
- package/src/schema.spec.ts +115 -0
- package/src/types.d.ts +8 -0
- package/src/types.js +1 -0
- package/src/utils/get-decorator-target-type.d.ts +27 -0
- package/src/utils/get-decorator-target-type.js +63 -0
- package/src/utils/get-decorator-target-type.spec.js +77 -0
- package/src/utils/index.d.ts +1 -0
- package/src/utils/index.js +1 -0
- package/src/utils/is-ctor.d.ts +2 -1
- package/src/utils/is-ctor.js +2 -1
- package/src/utils/is-ctor.spec.js +1 -1
- package/tsconfig.json +3 -1
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import {expect} from 'chai';
|
|
2
|
+
import {Schema} from './schema.js';
|
|
3
|
+
import {Repository} from './repository/index.js';
|
|
4
|
+
import {DefinitionRegistry} from './definition/index.js';
|
|
5
|
+
import {PropertyValidatorRegistry} from './definition/index.js';
|
|
6
|
+
|
|
7
|
+
describe('Schema', function () {
|
|
8
|
+
describe('defineDatasource', function () {
|
|
9
|
+
it('returns this', function () {
|
|
10
|
+
const schema = new Schema();
|
|
11
|
+
const res = schema.defineDatasource({
|
|
12
|
+
name: 'datasource',
|
|
13
|
+
adapter: 'memory',
|
|
14
|
+
});
|
|
15
|
+
expect(res).to.be.eq(schema);
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it('sets the datasource definition', function () {
|
|
19
|
+
const schema = new Schema();
|
|
20
|
+
schema.defineDatasource({name: 'datasource', adapter: 'memory'});
|
|
21
|
+
const res =
|
|
22
|
+
schema.getService(DefinitionRegistry).getDatasource('datasource');
|
|
23
|
+
expect(res).to.be.eql({name: 'datasource', adapter: 'memory'});
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
it('throws an error if the datasource name already defined', function () {
|
|
27
|
+
const schema = new Schema();
|
|
28
|
+
schema.defineDatasource({name: 'datasource', adapter: 'memory'});
|
|
29
|
+
const throwable =
|
|
30
|
+
() => schema.defineDatasource({name: 'datasource', adapter: 'memory'});
|
|
31
|
+
expect(throwable).to.throw(
|
|
32
|
+
'The datasource "datasource" is already defined.',
|
|
33
|
+
);
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
describe('defineModel', function () {
|
|
38
|
+
it('returns this', function () {
|
|
39
|
+
const schema = new Schema();
|
|
40
|
+
const res = schema.defineModel({name: 'model'});
|
|
41
|
+
expect(res).to.be.eq(schema);
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
it('sets the model definition', function () {
|
|
45
|
+
const schema = new Schema();
|
|
46
|
+
schema.defineModel({name: 'model'});
|
|
47
|
+
const res = schema.getService(DefinitionRegistry).getModel('model');
|
|
48
|
+
expect(res).to.be.eql({name: 'model'});
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
it('throws an error if the model name already defined', function () {
|
|
52
|
+
const schema = new Schema();
|
|
53
|
+
schema.defineModel({name: 'model'});
|
|
54
|
+
const throwable = () => schema.defineModel({name: 'model'});
|
|
55
|
+
expect(throwable).to.throw('The model "model" is already defined.');
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
describe('getRepository', function () {
|
|
60
|
+
it('returns a repository by the model name', function () {
|
|
61
|
+
const schema = new Schema();
|
|
62
|
+
schema.defineDatasource({name: 'datasource', adapter: 'memory'});
|
|
63
|
+
schema.defineModel({name: 'model', datasource: 'datasource'});
|
|
64
|
+
const res = schema.getRepository('model');
|
|
65
|
+
expect(res).to.be.instanceof(Repository);
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
it('throws an error if the model is not defined', function () {
|
|
69
|
+
const schema = new Schema();
|
|
70
|
+
const throwable = () => schema.getRepository('model');
|
|
71
|
+
expect(throwable).to.throw('The model "model" is not defined.');
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
it('uses generic types to define the repository type', function () {
|
|
75
|
+
const schema = new Schema();
|
|
76
|
+
schema.defineDatasource({name: 'datasource', adapter: 'memory'});
|
|
77
|
+
schema.defineModel({name: 'model', datasource: 'datasource'});
|
|
78
|
+
interface MyModel {
|
|
79
|
+
myId: number;
|
|
80
|
+
}
|
|
81
|
+
const res1: Repository = schema.getRepository('model');
|
|
82
|
+
const res2: Repository<MyModel, number, 'myId'> =
|
|
83
|
+
schema.getRepository<MyModel, number, 'myId'>('model');
|
|
84
|
+
expect(res1).to.be.eq(res2);
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
describe('addPropertyValidator', function () {
|
|
89
|
+
it('returns this', function () {
|
|
90
|
+
const schema = new Schema();
|
|
91
|
+
const res = schema.addPropertyValidator('validator', () => true);
|
|
92
|
+
expect(res).to.be.eq(schema);
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
it('adds a new property validator', function () {
|
|
96
|
+
const schema = new Schema();
|
|
97
|
+
const validator = () => true;
|
|
98
|
+
schema.addPropertyValidator('validator', validator);
|
|
99
|
+
const res = schema.getService(PropertyValidatorRegistry)
|
|
100
|
+
.getValidator('validator');
|
|
101
|
+
expect(res).to.be.eq(validator);
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
it('throws an error for already existing validator name', function () {
|
|
105
|
+
const schema = new Schema();
|
|
106
|
+
const validator = () => true;
|
|
107
|
+
schema.addPropertyValidator('validator', validator);
|
|
108
|
+
const throwable =
|
|
109
|
+
() => schema.addPropertyValidator('validator', validator);
|
|
110
|
+
expect(throwable).to.throw(
|
|
111
|
+
'The property validator "validator" is already defined.',
|
|
112
|
+
);
|
|
113
|
+
});
|
|
114
|
+
});
|
|
115
|
+
});
|
package/src/types.d.ts
CHANGED
|
@@ -28,3 +28,11 @@ export declare type ModelId = unknown;
|
|
|
28
28
|
*/
|
|
29
29
|
type Identity<T> = T;
|
|
30
30
|
export declare type Flatten<T> = Identity<{[k in keyof T]: T[k]}>;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* A callable type with the "new" operator
|
|
34
|
+
* allows class and constructor.
|
|
35
|
+
*/
|
|
36
|
+
export interface Constructor<T = unknown> {
|
|
37
|
+
new (...args: any[]): T;
|
|
38
|
+
}
|
package/src/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Decorator target type.
|
|
3
|
+
*/
|
|
4
|
+
export declare enum DecoratorTargetType {
|
|
5
|
+
CONSTRUCTOR = 'constructor',
|
|
6
|
+
INSTANCE = 'instance',
|
|
7
|
+
STATIC_METHOD = 'staticMethod',
|
|
8
|
+
INSTANCE_METHOD = 'instanceMethod',
|
|
9
|
+
STATIC_PROPERTY = 'staticProperty',
|
|
10
|
+
INSTANCE_PROPERTY = 'instanceProperty',
|
|
11
|
+
CONSTRUCTOR_PARAMETER = 'constructorParameter',
|
|
12
|
+
STATIC_METHOD_PARAMETER = 'staticMethodParameter',
|
|
13
|
+
INSTANCE_METHOD_PARAMETER = 'instanceMethodParameter',
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Get decorator target type.
|
|
18
|
+
*
|
|
19
|
+
* @param target
|
|
20
|
+
* @param propertyKey
|
|
21
|
+
* @param descriptorOrIndex
|
|
22
|
+
*/
|
|
23
|
+
export declare function getDecoratorTargetType(
|
|
24
|
+
target: object,
|
|
25
|
+
propertyKey?: string,
|
|
26
|
+
descriptorOrIndex?: PropertyDescriptor | number,
|
|
27
|
+
): DecoratorTargetType;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {object} PropertyDescriptor
|
|
3
|
+
* @property {boolean|undefined} configurable
|
|
4
|
+
* @property {boolean|undefined} enumerable
|
|
5
|
+
* @property {*} value
|
|
6
|
+
* @property {boolean|undefined} writable
|
|
7
|
+
* @property {Function} get
|
|
8
|
+
* @property {Function} set
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Decorator target type.
|
|
13
|
+
*
|
|
14
|
+
* @enum {string}
|
|
15
|
+
* @property {string} CONSTRUCTOR
|
|
16
|
+
* @property {string} INSTANCE
|
|
17
|
+
* @property {string} STATIC_METHOD
|
|
18
|
+
* @property {string} INSTANCE_METHOD
|
|
19
|
+
* @property {string} STATIC_PROPERTY
|
|
20
|
+
* @property {string} INSTANCE_PROPERTY
|
|
21
|
+
* @property {string} CONSTRUCTOR_PARAMETER
|
|
22
|
+
* @property {string} STATIC_METHOD_PARAMETER
|
|
23
|
+
* @property {string} INSTANCE_METHOD_PARAMETER
|
|
24
|
+
*/
|
|
25
|
+
export const DecoratorTargetType = {
|
|
26
|
+
CONSTRUCTOR: 'constructor',
|
|
27
|
+
INSTANCE: 'instance',
|
|
28
|
+
STATIC_METHOD: 'staticMethod',
|
|
29
|
+
INSTANCE_METHOD: 'instanceMethod',
|
|
30
|
+
STATIC_PROPERTY: 'staticProperty',
|
|
31
|
+
INSTANCE_PROPERTY: 'instanceProperty',
|
|
32
|
+
CONSTRUCTOR_PARAMETER: 'constructorParameter',
|
|
33
|
+
STATIC_METHOD_PARAMETER: 'staticMethodParameter',
|
|
34
|
+
INSTANCE_METHOD_PARAMETER: 'instanceMethodParameter',
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Get decorator target type.
|
|
39
|
+
*
|
|
40
|
+
* @param {object} target
|
|
41
|
+
* @param {string|undefined} propertyKey
|
|
42
|
+
* @param {PropertyDescriptor|number|undefined} descriptorOrIndex
|
|
43
|
+
* @returns {DecoratorTargetType}
|
|
44
|
+
*/
|
|
45
|
+
export function getDecoratorTargetType(target, propertyKey, descriptorOrIndex) {
|
|
46
|
+
const isCtor = typeof target === 'function';
|
|
47
|
+
const isParameter = typeof descriptorOrIndex === 'number';
|
|
48
|
+
const isProperty = propertyKey != null && descriptorOrIndex == null;
|
|
49
|
+
const isMethod = propertyKey != null && descriptorOrIndex != null;
|
|
50
|
+
const D = DecoratorTargetType;
|
|
51
|
+
if (isCtor) {
|
|
52
|
+
if (isParameter)
|
|
53
|
+
return propertyKey ? D.STATIC_METHOD_PARAMETER : D.CONSTRUCTOR_PARAMETER;
|
|
54
|
+
if (isProperty) return D.STATIC_PROPERTY;
|
|
55
|
+
if (isMethod) return D.STATIC_METHOD;
|
|
56
|
+
return D.CONSTRUCTOR;
|
|
57
|
+
} else {
|
|
58
|
+
if (isParameter) return D.INSTANCE_METHOD_PARAMETER;
|
|
59
|
+
if (isProperty) return D.INSTANCE_PROPERTY;
|
|
60
|
+
if (isMethod) return D.INSTANCE_METHOD;
|
|
61
|
+
return D.INSTANCE;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import {expect} from 'chai';
|
|
2
|
+
import {getDecoratorTargetType} from './get-decorator-target-type.js';
|
|
3
|
+
import {DecoratorTargetType as DTT} from './get-decorator-target-type.js';
|
|
4
|
+
|
|
5
|
+
describe('getDecoratorTargetType', function () {
|
|
6
|
+
const validate = function (value) {
|
|
7
|
+
return function (target, propertyKey, descriptorOrIndex) {
|
|
8
|
+
const type = getDecoratorTargetType(
|
|
9
|
+
target,
|
|
10
|
+
propertyKey,
|
|
11
|
+
descriptorOrIndex,
|
|
12
|
+
);
|
|
13
|
+
expect(value).to.be.eq(type);
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
it('returns CONSTRUCTOR', function () {
|
|
18
|
+
class Target {}
|
|
19
|
+
validate(DTT.CONSTRUCTOR)(Target);
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it('returns INSTANCE', function () {
|
|
23
|
+
class Target {}
|
|
24
|
+
validate(DTT.INSTANCE)(Target.prototype);
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
it('returns STATIC_METHOD', function () {
|
|
28
|
+
class Target {
|
|
29
|
+
static method() {}
|
|
30
|
+
}
|
|
31
|
+
const desc = Object.getOwnPropertyDescriptor(Target, 'method');
|
|
32
|
+
validate(DTT.STATIC_METHOD)(Target, 'method', desc);
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it('returns INSTANCE_METHOD', function () {
|
|
36
|
+
class Target {
|
|
37
|
+
method() {}
|
|
38
|
+
}
|
|
39
|
+
const desc = Object.getOwnPropertyDescriptor(Target.prototype, 'method');
|
|
40
|
+
validate(DTT.INSTANCE_METHOD)(Target.prototype, 'method', desc);
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
it('returns STATIC_PROPERTY', function () {
|
|
44
|
+
class Target {
|
|
45
|
+
static prop;
|
|
46
|
+
}
|
|
47
|
+
validate(DTT.STATIC_PROPERTY)(Target, 'prop');
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
it('returns INSTANCE_PROPERTY', function () {
|
|
51
|
+
class Target {
|
|
52
|
+
prop;
|
|
53
|
+
}
|
|
54
|
+
validate(DTT.INSTANCE_PROPERTY)(Target.prototype, 'prop');
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
it('returns CONSTRUCTOR_PARAMETER', function () {
|
|
58
|
+
class Target {
|
|
59
|
+
constructor(param) {}
|
|
60
|
+
}
|
|
61
|
+
validate(DTT.CONSTRUCTOR_PARAMETER)(Target, undefined, 0);
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
it('returns STATIC_METHOD_PARAMETER', function () {
|
|
65
|
+
class Target {
|
|
66
|
+
static method(param) {}
|
|
67
|
+
}
|
|
68
|
+
validate(DTT.STATIC_METHOD_PARAMETER)(Target, 'method', 0);
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
it('returns INSTANCE_METHOD_PARAMETER', function () {
|
|
72
|
+
class Target {
|
|
73
|
+
method(param) {}
|
|
74
|
+
}
|
|
75
|
+
validate(DTT.INSTANCE_METHOD_PARAMETER)(Target.prototype, 'method', 0);
|
|
76
|
+
});
|
|
77
|
+
});
|
package/src/utils/index.d.ts
CHANGED
package/src/utils/index.js
CHANGED
package/src/utils/is-ctor.d.ts
CHANGED
package/src/utils/is-ctor.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {expect} from 'chai';
|
|
2
2
|
import {isCtor} from './is-ctor.js';
|
|
3
3
|
|
|
4
|
-
describe('
|
|
4
|
+
describe('isCtor', function () {
|
|
5
5
|
it('returns true if a given value is a constructor', function () {
|
|
6
6
|
expect(isCtor(Date)).to.be.true;
|
|
7
7
|
expect(isCtor(Number)).to.be.true;
|
package/tsconfig.json
CHANGED