Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it("should return false (obj)", () => {
expect(isClass(Object)).to.eq(false);
});
it("should return false (arrow function)", () => {
expect(isClass(() => {})).to.eq(false);
});
it("should return false (date)", () => {
expect(isClass(new Date())).to.eq(false);
});
private static createJsonSchema(schema: JsonSchema = new JsonSchema(), type: any, collectionType?: any): JsonSchema {
if (isClass(type)) {
schema = Object.keys(schema.toObject()).reduce((newSchema: any, key: string) => {
if (!(key === "type" || key === "items" || key === "additionalProperties")) {
newSchema[key] = schema[key];
}
return newSchema;
}, JsonSchema.ref(type));
} else {
schema.type = type;
}
if (collectionType) {
schema.toCollection(collectionType);
}
return schema!;
set useClass(value: Type) {
if (isClass(value)) {
this._useClass = getClass(value);
this._store = Store.from(value);
}
}
async function resolveSymbols(item: any, excludes: string[]) {
if (isClass(item)) {
return await [item];
}
return importFiles(item, excludes);
}
.filter(symbol => isClass(symbol))
.forEach(symbol => {
static throwInjectorError(token: any, currentDependency: any, error: any) {
if (currentDependency && isClass(token)) {
error.message = printDependencyInjectionError(token, {...currentDependency, message: error.message});
}
throw new InjectionError(token, error);
}
}
.filter(token => isClass(token) && GlobalProviders.has(token))!;
} catch (er) {