From f3863e8abc7e3f257d2625dc8ccaa66e7a20c2dc Mon Sep 17 00:00:00 2001 From: Oleg Repin Date: Wed, 13 Nov 2019 12:38:56 +0200 Subject: [PATCH] lint project sources --- lib/index.ts | 6 +++--- lib/redis.constants.ts | 4 ++-- lib/redis.interface.ts | 8 +++++--- lib/redis.service.ts | 20 ++++++++++---------- 4 files changed, 20 insertions(+), 18 deletions(-) diff --git a/lib/index.ts b/lib/index.ts index f17fa36..3aae4f1 100644 --- a/lib/index.ts +++ b/lib/index.ts @@ -1,3 +1,3 @@ -export * from './redis.service' -export * from './redis.module' -export * from './redis.interface' \ No newline at end of file +export * from './redis.service'; +export * from './redis.module'; +export * from './redis.interface'; diff --git a/lib/redis.constants.ts b/lib/redis.constants.ts index 863a8fe..0bd4f75 100644 --- a/lib/redis.constants.ts +++ b/lib/redis.constants.ts @@ -1,2 +1,2 @@ -export const REDIS_MODULE_OPTIONS = Symbol('REDIS_MODULE_OPTIONS') -export const REDIS_CLIENT = Symbol('REDIS_CLIENT') \ No newline at end of file +export const REDIS_MODULE_OPTIONS = Symbol('REDIS_MODULE_OPTIONS'); +export const REDIS_CLIENT = Symbol('REDIS_CLIENT'); diff --git a/lib/redis.interface.ts b/lib/redis.interface.ts index 15393ab..82ff39f 100644 --- a/lib/redis.interface.ts +++ b/lib/redis.interface.ts @@ -2,13 +2,15 @@ import { ModuleMetadata } from '@nestjs/common/interfaces'; import { RedisOptions } from 'ioredis'; export interface RedisModuleOptions extends RedisOptions { - name?: string - url?: string + name?: string; + url?: string; } export interface RedisModuleAsyncOptions extends Pick { - useFactory?: (...args: any[]) => + useFactory?: ( + ...args: any[] + ) => | RedisModuleOptions | RedisModuleOptions[] | Promise diff --git a/lib/redis.service.ts b/lib/redis.service.ts index 1e4e35a..3825389 100644 --- a/lib/redis.service.ts +++ b/lib/redis.service.ts @@ -1,24 +1,24 @@ -import { Injectable, Inject } from "@nestjs/common"; +import { Injectable, Inject } from '@nestjs/common'; import { REDIS_CLIENT } from './redis.constants'; -import * as Redis from "ioredis"; -import { RedisClient, RedisClientError } from "./redis-client.provider"; +import * as Redis from 'ioredis'; +import { RedisClient, RedisClientError } from './redis-client.provider'; @Injectable() export class RedisService { constructor( - @Inject(REDIS_CLIENT) private readonly redisClient: RedisClient - ) { } + @Inject(REDIS_CLIENT) private readonly redisClient: RedisClient, + ) {} getClient(name?: string): Redis.Redis { if (!name) { - name = this.redisClient.defaultKey - } + name = this.redisClient.defaultKey; + } if (!this.redisClient.clients.has(name)) { - throw new RedisClientError(`client ${name} is not exists`) + throw new RedisClientError(`client ${name} is not exists`); } - return this.redisClient.clients.get(name) + return this.redisClient.clients.get(name); } - + getClients(): Map { return this.redisClient.clients; }