@powfix/core-js 0.13.32 → 0.13.34

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.
@@ -11,6 +11,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.RedisSubscriber = void 0;
13
13
  const RedisClient_1 = require("./RedisClient");
14
+ const utils_1 = require("../../utils");
14
15
  class RedisSubscriber extends RedisClient_1.RedisClient {
15
16
  constructor(options) {
16
17
  super(options);
@@ -18,7 +19,7 @@ class RedisSubscriber extends RedisClient_1.RedisClient {
18
19
  }
19
20
  subscribe(channels, listener, bufferMode) {
20
21
  return __awaiter(this, void 0, void 0, function* () {
21
- for (const channel of Array.isArray(channels) ? channels : [channels]) {
22
+ for (const channel of (0, utils_1.castArray)(channels)) {
22
23
  if ((/\*/g).test(channel)) {
23
24
  yield this.client.pSubscribe(channel, listener, bufferMode);
24
25
  }
@@ -30,7 +31,7 @@ class RedisSubscriber extends RedisClient_1.RedisClient {
30
31
  }
31
32
  unsubscribe(channels, listener, bufferMode) {
32
33
  return __awaiter(this, void 0, void 0, function* () {
33
- for (const channel of Array.isArray(channels) ? channels : [channels]) {
34
+ for (const channel of (0, utils_1.castArray)(channels)) {
34
35
  if ((/\*/g).test(channel)) {
35
36
  yield this.client.pUnsubscribe(channel, listener, bufferMode);
36
37
  }
@@ -1,4 +1,5 @@
1
1
  export declare class ArrayUtils {
2
+ static castArray<T>(value: T | T[]): T[];
2
3
  /**
3
4
  * 객체를 요소로 가지는 배열에서 가장 큰 값(Property)를 가지는 객체를 반환한다
4
5
  * @param e 객체 배열
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ArrayUtils = void 0;
4
+ const global_1 = require("./global");
4
5
  class ArrayUtils {
6
+ static castArray(value) {
7
+ return (0, global_1.castArray)(value);
8
+ }
5
9
  /**
6
10
  * 객체를 요소로 가지는 배열에서 가장 큰 값(Property)를 가지는 객체를 반환한다
7
11
  * @param e 객체 배열
@@ -0,0 +1 @@
1
+ export declare function castArray<T>(value: T | T[]): T[];
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.castArray = castArray;
4
+ function castArray(value) {
5
+ return Array.isArray(value) ? value : [value];
6
+ }
@@ -1,4 +1,5 @@
1
1
  export * from './between';
2
+ export * from './castArray';
2
3
  export * from './circularDistance';
3
4
  export * from './sleep';
4
5
  export * from './fallbackIfEqual';
@@ -15,6 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./between"), exports);
18
+ __exportStar(require("./castArray"), exports);
18
19
  __exportStar(require("./circularDistance"), exports);
19
20
  __exportStar(require("./sleep"), exports);
20
21
  __exportStar(require("./fallbackIfEqual"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powfix/core-js",
3
- "version": "0.13.32",
3
+ "version": "0.13.34",
4
4
  "description": "core package",
5
5
  "author": "Kwon Kyung-Min <powfix@gmail.com>",
6
6
  "private": false,