@viardex/viardex-libs 1.0.11 → 1.0.12
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/README.md +14 -14
- package/dist/cache/{cache.service.d.ts → index.d.mts} +14 -4
- package/dist/cache/index.d.ts +40 -3
- package/dist/cache/index.js +227 -17
- package/dist/cache/index.js.map +1 -0
- package/dist/cache/index.mjs +193 -0
- package/dist/cache/index.mjs.map +1 -0
- package/dist/common/index.d.mts +215 -0
- package/dist/common/index.d.ts +215 -10
- package/dist/common/index.js +979 -26
- package/dist/common/index.js.map +1 -0
- package/dist/common/index.mjs +874 -0
- package/dist/common/index.mjs.map +1 -0
- package/dist/index.d.mts +11 -0
- package/dist/index.d.ts +11 -9
- package/dist/index.js +1661 -25
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +1527 -0
- package/dist/index.mjs.map +1 -0
- package/dist/logger/index.d.mts +15 -0
- package/dist/logger/index.d.ts +14 -2
- package/dist/logger/index.js +207 -19
- package/dist/logger/index.js.map +1 -0
- package/dist/logger/index.mjs +183 -0
- package/dist/logger/index.mjs.map +1 -0
- package/dist/nats/{constants/nats.constants.d.ts → index.d.mts} +61 -18
- package/dist/nats/index.d.ts +200 -5
- package/dist/nats/index.js +270 -20
- package/dist/nats/index.js.map +1 -0
- package/dist/nats/index.mjs +226 -0
- package/dist/nats/index.mjs.map +1 -0
- package/dist/rpc/index.d.mts +22 -0
- package/dist/rpc/index.d.ts +7 -3
- package/dist/rpc/index.js +91 -63
- package/dist/rpc/index.js.map +1 -0
- package/dist/rpc/index.mjs +71 -0
- package/dist/rpc/index.mjs.map +1 -0
- package/package.json +30 -60
- package/dist/argon/argon.module.d.ts +0 -2
- package/dist/argon/argon.module.js +0 -21
- package/dist/argon/argon.service.d.ts +0 -6
- package/dist/argon/argon.service.js +0 -74
- package/dist/argon/index.d.ts +0 -2
- package/dist/argon/index.js +0 -18
- package/dist/auth/auth.constants.d.ts +0 -4
- package/dist/auth/auth.constants.js +0 -7
- package/dist/auth/auth.interfaces.d.ts +0 -19
- package/dist/auth/auth.interfaces.js +0 -2
- package/dist/auth/auth.module.d.ts +0 -2
- package/dist/auth/auth.module.js +0 -31
- package/dist/auth/auth.service.d.ts +0 -13
- package/dist/auth/auth.service.js +0 -104
- package/dist/auth/decorators/auth-token-types.decorator.d.ts +0 -2
- package/dist/auth/decorators/auth-token-types.decorator.js +0 -7
- package/dist/auth/decorators/current-auth.decorator.d.ts +0 -1
- package/dist/auth/decorators/current-auth.decorator.js +0 -10
- package/dist/auth/decorators/index.d.ts +0 -5
- package/dist/auth/decorators/index.js +0 -21
- package/dist/auth/decorators/permissions.decorator.d.ts +0 -1
- package/dist/auth/decorators/permissions.decorator.js +0 -7
- package/dist/auth/decorators/public.decorator.d.ts +0 -1
- package/dist/auth/decorators/public.decorator.js +0 -7
- package/dist/auth/decorators/roles.decorator.d.ts +0 -1
- package/dist/auth/decorators/roles.decorator.js +0 -7
- package/dist/auth/guards/auth.guard.d.ts +0 -10
- package/dist/auth/guards/auth.guard.js +0 -65
- package/dist/auth/guards/index.d.ts +0 -3
- package/dist/auth/guards/index.js +0 -19
- package/dist/auth/guards/permissions.guard.d.ts +0 -7
- package/dist/auth/guards/permissions.guard.js +0 -52
- package/dist/auth/guards/roles.guard.d.ts +0 -7
- package/dist/auth/guards/roles.guard.js +0 -53
- package/dist/auth/index.d.ts +0 -6
- package/dist/auth/index.js +0 -22
- package/dist/cache/cache.constants.d.ts +0 -1
- package/dist/cache/cache.constants.js +0 -4
- package/dist/cache/cache.interface.d.ts +0 -2
- package/dist/cache/cache.interface.js +0 -2
- package/dist/cache/cache.module.d.ts +0 -5
- package/dist/cache/cache.module.js +0 -31
- package/dist/cache/cache.service.js +0 -125
- package/dist/common/cards/card.utils.d.ts +0 -9
- package/dist/common/cards/card.utils.js +0 -48
- package/dist/common/cards/index.d.ts +0 -1
- package/dist/common/cards/index.js +0 -17
- package/dist/common/config/index.d.ts +0 -1
- package/dist/common/config/index.js +0 -17
- package/dist/common/config/nats.config.d.ts +0 -8
- package/dist/common/config/nats.config.js +0 -33
- package/dist/common/constants/index.d.ts +0 -2
- package/dist/common/constants/index.js +0 -18
- package/dist/common/constants/otp.constants.d.ts +0 -15
- package/dist/common/constants/otp.constants.js +0 -18
- package/dist/common/constants/queues.constants.d.ts +0 -9
- package/dist/common/constants/queues.constants.js +0 -12
- package/dist/common/crypto/crypto.utils.d.ts +0 -7
- package/dist/common/crypto/crypto.utils.js +0 -42
- package/dist/common/crypto/index.d.ts +0 -1
- package/dist/common/crypto/index.js +0 -17
- package/dist/common/dto/index.d.ts +0 -1
- package/dist/common/dto/index.js +0 -17
- package/dist/common/dto/pagination-query.dto.d.ts +0 -7
- package/dist/common/dto/pagination-query.dto.js +0 -51
- package/dist/common/enums/index.d.ts +0 -1
- package/dist/common/enums/index.js +0 -17
- package/dist/common/enums/otp.enum.d.ts +0 -16
- package/dist/common/enums/otp.enum.js +0 -20
- package/dist/common/interfaces/index.d.ts +0 -1
- package/dist/common/interfaces/index.js +0 -17
- package/dist/common/interfaces/response.interface.d.ts +0 -27
- package/dist/common/interfaces/response.interface.js +0 -2
- package/dist/common/pipes/file-validation.pipe.d.ts +0 -22
- package/dist/common/pipes/file-validation.pipe.js +0 -78
- package/dist/common/pipes/index.d.ts +0 -2
- package/dist/common/pipes/index.js +0 -18
- package/dist/common/pipes/pagination-query-cleaner.pipe.d.ts +0 -4
- package/dist/common/pipes/pagination-query-cleaner.pipe.js +0 -24
- package/dist/common/response/http-exception.filter.d.ts +0 -6
- package/dist/common/response/http-exception.filter.js +0 -61
- package/dist/common/response/http-only-exception.filter.d.ts +0 -5
- package/dist/common/response/http-only-exception.filter.js +0 -24
- package/dist/common/response/index.d.ts +0 -4
- package/dist/common/response/index.js +0 -20
- package/dist/common/response/response.interceptor.d.ts +0 -6
- package/dist/common/response/response.interceptor.js +0 -57
- package/dist/common/response/response.utils.d.ts +0 -6
- package/dist/common/response/response.utils.js +0 -34
- package/dist/common/utils/country.utils.d.ts +0 -1
- package/dist/common/utils/country.utils.js +0 -38
- package/dist/common/utils/date.utils.d.ts +0 -6
- package/dist/common/utils/date.utils.js +0 -48
- package/dist/common/utils/decimal.utils.d.ts +0 -3
- package/dist/common/utils/decimal.utils.js +0 -22
- package/dist/common/utils/format.utils.d.ts +0 -13
- package/dist/common/utils/format.utils.js +0 -127
- package/dist/common/utils/index.d.ts +0 -8
- package/dist/common/utils/index.js +0 -24
- package/dist/common/utils/random.utils.d.ts +0 -10
- package/dist/common/utils/random.utils.js +0 -27
- package/dist/common/utils/reference.utils.d.ts +0 -1
- package/dist/common/utils/reference.utils.js +0 -17
- package/dist/common/utils/string.utils.d.ts +0 -10
- package/dist/common/utils/string.utils.js +0 -34
- package/dist/common/utils/validation.utils.d.ts +0 -8
- package/dist/common/utils/validation.utils.js +0 -44
- package/dist/health/health.controller.d.ts +0 -19
- package/dist/health/health.controller.js +0 -103
- package/dist/health/health.module.d.ts +0 -2
- package/dist/health/health.module.js +0 -21
- package/dist/health/index.d.ts +0 -2
- package/dist/health/index.js +0 -18
- package/dist/logger/logger.module.d.ts +0 -2
- package/dist/logger/logger.module.js +0 -72
- package/dist/logger/logging.interceptor.d.ts +0 -8
- package/dist/logger/logging.interceptor.js +0 -66
- package/dist/nats/constants/nats.constants.js +0 -101
- package/dist/nats/decorators/nats-event-pattern.decorator.d.ts +0 -2
- package/dist/nats/decorators/nats-event-pattern.decorator.js +0 -11
- package/dist/nats/dto/nats-message.dto.d.ts +0 -5
- package/dist/nats/dto/nats-message.dto.js +0 -33
- package/dist/nats/interceptors/nats-logging.interceptor.d.ts +0 -6
- package/dist/nats/interceptors/nats-logging.interceptor.js +0 -33
- package/dist/nats/interfaces/nats-options.interface.d.ts +0 -23
- package/dist/nats/interfaces/nats-options.interface.js +0 -2
- package/dist/storage/index.d.ts +0 -5
- package/dist/storage/index.js +0 -21
- package/dist/storage/r2.service.d.ts +0 -20
- package/dist/storage/r2.service.js +0 -213
- package/dist/storage/s3.service.d.ts +0 -20
- package/dist/storage/s3.service.js +0 -209
- package/dist/storage/storage.interface.d.ts +0 -29
- package/dist/storage/storage.interface.js +0 -2
- package/dist/storage/storage.module.d.ts +0 -2
- package/dist/storage/storage.module.js +0 -24
- package/dist/storage/storage.service.d.ts +0 -22
- package/dist/storage/storage.service.js +0 -63
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
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;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var HttpExceptionFilter_1;
|
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.HttpExceptionFilter = void 0;
|
|
11
|
-
const common_1 = require("@nestjs/common");
|
|
12
|
-
const response_utils_1 = require("./response.utils");
|
|
13
|
-
let HttpExceptionFilter = HttpExceptionFilter_1 = class HttpExceptionFilter {
|
|
14
|
-
logger = new common_1.Logger(HttpExceptionFilter_1.name);
|
|
15
|
-
catch(exception, host) {
|
|
16
|
-
const ctx = host.switchToHttp();
|
|
17
|
-
const response = ctx.getResponse();
|
|
18
|
-
const request = ctx.getRequest();
|
|
19
|
-
const status = exception instanceof common_1.HttpException
|
|
20
|
-
? exception.getStatus()
|
|
21
|
-
: common_1.HttpStatus.INTERNAL_SERVER_ERROR;
|
|
22
|
-
const message = exception instanceof common_1.HttpException
|
|
23
|
-
? exception.message
|
|
24
|
-
: 'An unexpected error occurred';
|
|
25
|
-
const errors = this.getValidationErrors(exception);
|
|
26
|
-
this.logger.error({
|
|
27
|
-
method: request.method,
|
|
28
|
-
url: request.url,
|
|
29
|
-
statusCode: status,
|
|
30
|
-
error: message,
|
|
31
|
-
stack: exception instanceof Error ? exception.stack : undefined,
|
|
32
|
-
}, 'HTTP request failed');
|
|
33
|
-
const body = response_utils_1.AppResponse.error(message, errors, {
|
|
34
|
-
path: request.url ? `${request.method ?? 'GET'} ${request.url}` : undefined,
|
|
35
|
-
requestId: request.requestId ?? request.id,
|
|
36
|
-
timestamp: new Date().toISOString(),
|
|
37
|
-
});
|
|
38
|
-
response.status(status).send(body);
|
|
39
|
-
}
|
|
40
|
-
getValidationErrors(exception) {
|
|
41
|
-
if (!(exception instanceof common_1.BadRequestException)) {
|
|
42
|
-
return undefined;
|
|
43
|
-
}
|
|
44
|
-
const payload = exception.getResponse();
|
|
45
|
-
if (typeof payload === 'object' && payload !== null) {
|
|
46
|
-
const errors = payload.errors;
|
|
47
|
-
if (Array.isArray(errors)) {
|
|
48
|
-
return errors;
|
|
49
|
-
}
|
|
50
|
-
const message = payload.message;
|
|
51
|
-
if (Array.isArray(message)) {
|
|
52
|
-
return message.map((item) => ({ message: String(item) }));
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
return undefined;
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
exports.HttpExceptionFilter = HttpExceptionFilter;
|
|
59
|
-
exports.HttpExceptionFilter = HttpExceptionFilter = HttpExceptionFilter_1 = __decorate([
|
|
60
|
-
(0, common_1.Catch)()
|
|
61
|
-
], HttpExceptionFilter);
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
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;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.HttpOnlyExceptionFilter = void 0;
|
|
10
|
-
const common_1 = require("@nestjs/common");
|
|
11
|
-
const http_exception_filter_1 = require("./http-exception.filter");
|
|
12
|
-
let HttpOnlyExceptionFilter = class HttpOnlyExceptionFilter {
|
|
13
|
-
httpExceptionFilter = new http_exception_filter_1.HttpExceptionFilter();
|
|
14
|
-
catch(exception, host) {
|
|
15
|
-
if (host.getType() !== 'http') {
|
|
16
|
-
throw exception;
|
|
17
|
-
}
|
|
18
|
-
this.httpExceptionFilter.catch(exception, host);
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
exports.HttpOnlyExceptionFilter = HttpOnlyExceptionFilter;
|
|
22
|
-
exports.HttpOnlyExceptionFilter = HttpOnlyExceptionFilter = __decorate([
|
|
23
|
-
(0, common_1.Catch)()
|
|
24
|
-
], HttpOnlyExceptionFilter);
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./http-exception.filter"), exports);
|
|
18
|
-
__exportStar(require("./http-only-exception.filter"), exports);
|
|
19
|
-
__exportStar(require("./response.interceptor"), exports);
|
|
20
|
-
__exportStar(require("./response.utils"), exports);
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { CallHandler, ExecutionContext, NestInterceptor } from '@nestjs/common';
|
|
2
|
-
import { Observable } from 'rxjs';
|
|
3
|
-
import type { ApiResponse } from '../interfaces';
|
|
4
|
-
export declare class ResponseInterceptor<T> implements NestInterceptor<T, ApiResponse<T>> {
|
|
5
|
-
intercept(context: ExecutionContext, next: CallHandler): Observable<ApiResponse<T>>;
|
|
6
|
-
}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
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;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.ResponseInterceptor = void 0;
|
|
10
|
-
const common_1 = require("@nestjs/common");
|
|
11
|
-
const operators_1 = require("rxjs/operators");
|
|
12
|
-
const response_utils_1 = require("./response.utils");
|
|
13
|
-
function isApiResponse(value) {
|
|
14
|
-
return (typeof value === 'object' &&
|
|
15
|
-
value !== null &&
|
|
16
|
-
'success' in value &&
|
|
17
|
-
'message' in value &&
|
|
18
|
-
'data' in value);
|
|
19
|
-
}
|
|
20
|
-
function isPaginatedPayload(value) {
|
|
21
|
-
return (typeof value === 'object' &&
|
|
22
|
-
value !== null &&
|
|
23
|
-
'items' in value &&
|
|
24
|
-
Array.isArray(value.items) &&
|
|
25
|
-
'pagination' in value);
|
|
26
|
-
}
|
|
27
|
-
let ResponseInterceptor = class ResponseInterceptor {
|
|
28
|
-
intercept(context, next) {
|
|
29
|
-
if (context.getType() !== 'http') {
|
|
30
|
-
return next.handle();
|
|
31
|
-
}
|
|
32
|
-
const request = context.switchToHttp().getRequest();
|
|
33
|
-
return next.handle().pipe((0, operators_1.map)((data) => {
|
|
34
|
-
if (isApiResponse(data)) {
|
|
35
|
-
return data;
|
|
36
|
-
}
|
|
37
|
-
const meta = {
|
|
38
|
-
path: request.url
|
|
39
|
-
? `${request.method ?? 'GET'} ${request.url}`
|
|
40
|
-
: undefined,
|
|
41
|
-
requestId: request.requestId ?? request.id,
|
|
42
|
-
timestamp: new Date().toISOString(),
|
|
43
|
-
};
|
|
44
|
-
if (isPaginatedPayload(data)) {
|
|
45
|
-
return response_utils_1.AppResponse.paginated(data.message ?? 'Request successful', data.items, data.pagination, {
|
|
46
|
-
...meta,
|
|
47
|
-
...data.meta,
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
return response_utils_1.AppResponse.success('Request successful', data, meta);
|
|
51
|
-
}));
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
exports.ResponseInterceptor = ResponseInterceptor;
|
|
55
|
-
exports.ResponseInterceptor = ResponseInterceptor = __decorate([
|
|
56
|
-
(0, common_1.Injectable)()
|
|
57
|
-
], ResponseInterceptor);
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { ApiResponse, ErrorDetail, PaginationMeta, ResponseMeta } from '../interfaces';
|
|
2
|
-
export declare class AppResponse {
|
|
3
|
-
static success<T>(message: string, data: T, meta?: ResponseMeta): ApiResponse<T>;
|
|
4
|
-
static paginated<T>(message: string, items: T[], pagination: PaginationMeta, meta?: Omit<ResponseMeta, 'pagination'>): ApiResponse<T[]>;
|
|
5
|
-
static error(message: string, errors?: ErrorDetail[], meta?: ResponseMeta, data?: null): ApiResponse<null>;
|
|
6
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AppResponse = void 0;
|
|
4
|
-
class AppResponse {
|
|
5
|
-
static success(message, data, meta) {
|
|
6
|
-
return {
|
|
7
|
-
success: true,
|
|
8
|
-
message,
|
|
9
|
-
data,
|
|
10
|
-
...(meta ? { meta } : {}),
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
static paginated(message, items, pagination, meta) {
|
|
14
|
-
return {
|
|
15
|
-
success: true,
|
|
16
|
-
message,
|
|
17
|
-
data: items,
|
|
18
|
-
meta: {
|
|
19
|
-
...meta,
|
|
20
|
-
pagination,
|
|
21
|
-
},
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
static error(message, errors, meta, data = null) {
|
|
25
|
-
return {
|
|
26
|
-
success: false,
|
|
27
|
-
message,
|
|
28
|
-
data,
|
|
29
|
-
...(meta ? { meta } : {}),
|
|
30
|
-
...(errors?.length ? { errors } : {}),
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
exports.AppResponse = AppResponse;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const countryDialCodes: string[];
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.countryDialCodes = void 0;
|
|
37
|
-
const CountryCodeList = __importStar(require("country-codes-list"));
|
|
38
|
-
exports.countryDialCodes = Object.keys(CountryCodeList.customList('countryCallingCode')).map((code) => `+${code}`);
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export type RecurrenceFrequency = 'DAILY' | 'WEEKLY' | 'MONTHLY';
|
|
2
|
-
export declare const calculateNextDate: (frequency: RecurrenceFrequency, lastDate: Date) => Date;
|
|
3
|
-
export declare const isToday: (date: Date | string) => boolean;
|
|
4
|
-
export declare const isNotPastDate: (date: Date | string) => boolean;
|
|
5
|
-
export declare const isDateInRange: (date: Date | string, minDate: Date | string, maxDate: Date | string) => boolean;
|
|
6
|
-
export declare const isValidAge: (dateOfBirth: Date | string, minAge?: number) => boolean;
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isValidAge = exports.isDateInRange = exports.isNotPastDate = exports.isToday = exports.calculateNextDate = void 0;
|
|
4
|
-
const calculateNextDate = (frequency, lastDate) => {
|
|
5
|
-
const nextDate = new Date(lastDate);
|
|
6
|
-
switch (frequency) {
|
|
7
|
-
case 'DAILY':
|
|
8
|
-
nextDate.setDate(nextDate.getDate() + 1);
|
|
9
|
-
return nextDate;
|
|
10
|
-
case 'WEEKLY':
|
|
11
|
-
nextDate.setDate(nextDate.getDate() + 7);
|
|
12
|
-
return nextDate;
|
|
13
|
-
case 'MONTHLY':
|
|
14
|
-
nextDate.setMonth(nextDate.getMonth() + 1);
|
|
15
|
-
return nextDate;
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
exports.calculateNextDate = calculateNextDate;
|
|
19
|
-
const isToday = (date) => {
|
|
20
|
-
const currentDate = new Date(date);
|
|
21
|
-
const today = new Date();
|
|
22
|
-
return (currentDate.getDate() === today.getDate() &&
|
|
23
|
-
currentDate.getMonth() === today.getMonth() &&
|
|
24
|
-
currentDate.getFullYear() === today.getFullYear());
|
|
25
|
-
};
|
|
26
|
-
exports.isToday = isToday;
|
|
27
|
-
const isNotPastDate = (date) => {
|
|
28
|
-
return new Date(date).getTime() >= Date.now();
|
|
29
|
-
};
|
|
30
|
-
exports.isNotPastDate = isNotPastDate;
|
|
31
|
-
const isDateInRange = (date, minDate, maxDate) => {
|
|
32
|
-
const timestamp = new Date(date).getTime();
|
|
33
|
-
return (timestamp >= new Date(minDate).getTime() &&
|
|
34
|
-
timestamp <= new Date(maxDate).getTime());
|
|
35
|
-
};
|
|
36
|
-
exports.isDateInRange = isDateInRange;
|
|
37
|
-
const isValidAge = (dateOfBirth, minAge = 18) => {
|
|
38
|
-
const today = new Date();
|
|
39
|
-
const birthDate = new Date(dateOfBirth);
|
|
40
|
-
let age = today.getFullYear() - birthDate.getFullYear();
|
|
41
|
-
const monthDiff = today.getMonth() - birthDate.getMonth();
|
|
42
|
-
if (monthDiff < 0 ||
|
|
43
|
-
(monthDiff === 0 && today.getDate() < birthDate.getDate())) {
|
|
44
|
-
age--;
|
|
45
|
-
}
|
|
46
|
-
return age >= minAge;
|
|
47
|
-
};
|
|
48
|
-
exports.isValidAge = isValidAge;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.toRoundedNumber = exports.toDecimal = void 0;
|
|
7
|
-
const decimal_js_1 = __importDefault(require("decimal.js"));
|
|
8
|
-
const DEFAULT_DECIMAL_PLACES = 4;
|
|
9
|
-
decimal_js_1.default.set({ precision: 20, rounding: decimal_js_1.default.ROUND_HALF_UP });
|
|
10
|
-
const toDecimal = (value) => {
|
|
11
|
-
try {
|
|
12
|
-
return new decimal_js_1.default(value);
|
|
13
|
-
}
|
|
14
|
-
catch {
|
|
15
|
-
throw new Error(`Invalid decimal value: ${value}`);
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
exports.toDecimal = toDecimal;
|
|
19
|
-
const toRoundedNumber = (value, decimalPlaces = DEFAULT_DECIMAL_PLACES) => {
|
|
20
|
-
return (0, exports.toDecimal)(value).toDecimalPlaces(decimalPlaces).toNumber();
|
|
21
|
-
};
|
|
22
|
-
exports.toRoundedNumber = toRoundedNumber;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export declare const formatCurrency: (amount: number, currencySymbol?: string, decimals?: number) => string;
|
|
2
|
-
export declare const formatAmount: (amount: number, decimals?: number, locale?: string) => string;
|
|
3
|
-
export declare const formatAccountNumber: (accountNumber: string) => string;
|
|
4
|
-
export declare const maskAccountNumber: (accountNumber: string) => string;
|
|
5
|
-
export declare const maskEmail: (email: string) => string;
|
|
6
|
-
export declare const formatDate: (date: Date | string) => string;
|
|
7
|
-
export declare const formatDateTime: (date: Date | string) => string;
|
|
8
|
-
export declare const formatRelativeTime: (date: Date | string) => string;
|
|
9
|
-
export declare const formatPercentage: (value: number, decimals?: number) => string;
|
|
10
|
-
export declare const formatFileSize: (bytes: number) => string;
|
|
11
|
-
export declare const truncateText: (text: string, maxLength: number) => string;
|
|
12
|
-
export declare const toTitleCase: (text: string) => string;
|
|
13
|
-
export declare const normalizeNigerianPhone: (phone: string | number, withPlus?: boolean) => string;
|
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.normalizeNigerianPhone = exports.toTitleCase = exports.truncateText = exports.formatFileSize = exports.formatPercentage = exports.formatRelativeTime = exports.formatDateTime = exports.formatDate = exports.maskEmail = exports.maskAccountNumber = exports.formatAccountNumber = exports.formatAmount = exports.formatCurrency = void 0;
|
|
4
|
-
const formatCurrency = (amount, currencySymbol = '₦', decimals = 2) => {
|
|
5
|
-
const formatted = amount.toLocaleString('en-NG', {
|
|
6
|
-
minimumFractionDigits: decimals,
|
|
7
|
-
maximumFractionDigits: decimals,
|
|
8
|
-
});
|
|
9
|
-
return `${currencySymbol}${formatted}`;
|
|
10
|
-
};
|
|
11
|
-
exports.formatCurrency = formatCurrency;
|
|
12
|
-
const formatAmount = (amount, decimals = 2, locale = 'en-NG') => {
|
|
13
|
-
return amount.toLocaleString(locale, {
|
|
14
|
-
minimumFractionDigits: decimals,
|
|
15
|
-
maximumFractionDigits: decimals,
|
|
16
|
-
});
|
|
17
|
-
};
|
|
18
|
-
exports.formatAmount = formatAmount;
|
|
19
|
-
const formatAccountNumber = (accountNumber) => {
|
|
20
|
-
if (accountNumber.length !== 10) {
|
|
21
|
-
return accountNumber;
|
|
22
|
-
}
|
|
23
|
-
return `${accountNumber.slice(0, 4)} ${accountNumber.slice(4, 8)} ${accountNumber.slice(8)}`;
|
|
24
|
-
};
|
|
25
|
-
exports.formatAccountNumber = formatAccountNumber;
|
|
26
|
-
const maskAccountNumber = (accountNumber) => {
|
|
27
|
-
if (accountNumber.length < 4) {
|
|
28
|
-
return accountNumber;
|
|
29
|
-
}
|
|
30
|
-
return '*'.repeat(accountNumber.length - 4) + accountNumber.slice(-4);
|
|
31
|
-
};
|
|
32
|
-
exports.maskAccountNumber = maskAccountNumber;
|
|
33
|
-
const maskEmail = (email) => {
|
|
34
|
-
const [username, domain] = email.split('@');
|
|
35
|
-
if (!username || !domain) {
|
|
36
|
-
return email;
|
|
37
|
-
}
|
|
38
|
-
return `${username[0]}${'*'.repeat(Math.max(0, username.length - 1))}@${domain}`;
|
|
39
|
-
};
|
|
40
|
-
exports.maskEmail = maskEmail;
|
|
41
|
-
const formatDate = (date) => {
|
|
42
|
-
const currentDate = new Date(date);
|
|
43
|
-
const day = String(currentDate.getDate()).padStart(2, '0');
|
|
44
|
-
const month = String(currentDate.getMonth() + 1).padStart(2, '0');
|
|
45
|
-
const year = currentDate.getFullYear();
|
|
46
|
-
return `${day}/${month}/${year}`;
|
|
47
|
-
};
|
|
48
|
-
exports.formatDate = formatDate;
|
|
49
|
-
const formatDateTime = (date) => {
|
|
50
|
-
const currentDate = new Date(date);
|
|
51
|
-
const hours = String(currentDate.getHours()).padStart(2, '0');
|
|
52
|
-
const minutes = String(currentDate.getMinutes()).padStart(2, '0');
|
|
53
|
-
return `${(0, exports.formatDate)(currentDate)} ${hours}:${minutes}`;
|
|
54
|
-
};
|
|
55
|
-
exports.formatDateTime = formatDateTime;
|
|
56
|
-
const formatRelativeTime = (date) => {
|
|
57
|
-
const currentDate = new Date(date);
|
|
58
|
-
const diffMs = Date.now() - currentDate.getTime();
|
|
59
|
-
const diffSeconds = Math.floor(diffMs / 1000);
|
|
60
|
-
const diffMinutes = Math.floor(diffSeconds / 60);
|
|
61
|
-
const diffHours = Math.floor(diffMinutes / 60);
|
|
62
|
-
const diffDays = Math.floor(diffHours / 24);
|
|
63
|
-
if (diffSeconds < 60) {
|
|
64
|
-
return 'Just now';
|
|
65
|
-
}
|
|
66
|
-
if (diffMinutes < 60) {
|
|
67
|
-
return `${diffMinutes} minute${diffMinutes > 1 ? 's' : ''} ago`;
|
|
68
|
-
}
|
|
69
|
-
if (diffHours < 24) {
|
|
70
|
-
return `${diffHours} hour${diffHours > 1 ? 's' : ''} ago`;
|
|
71
|
-
}
|
|
72
|
-
if (diffDays < 7) {
|
|
73
|
-
return `${diffDays} day${diffDays > 1 ? 's' : ''} ago`;
|
|
74
|
-
}
|
|
75
|
-
return (0, exports.formatDate)(currentDate);
|
|
76
|
-
};
|
|
77
|
-
exports.formatRelativeTime = formatRelativeTime;
|
|
78
|
-
const formatPercentage = (value, decimals = 1) => {
|
|
79
|
-
return `${(value * 100).toFixed(decimals)}%`;
|
|
80
|
-
};
|
|
81
|
-
exports.formatPercentage = formatPercentage;
|
|
82
|
-
const formatFileSize = (bytes) => {
|
|
83
|
-
if (bytes === 0) {
|
|
84
|
-
return '0 Bytes';
|
|
85
|
-
}
|
|
86
|
-
const unit = 1024;
|
|
87
|
-
const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB'];
|
|
88
|
-
const sizeIndex = Math.floor(Math.log(bytes) / Math.log(unit));
|
|
89
|
-
return `${Number((bytes / unit ** sizeIndex).toFixed(2))} ${sizes[sizeIndex]}`;
|
|
90
|
-
};
|
|
91
|
-
exports.formatFileSize = formatFileSize;
|
|
92
|
-
const truncateText = (text, maxLength) => {
|
|
93
|
-
if (text.length <= maxLength) {
|
|
94
|
-
return text;
|
|
95
|
-
}
|
|
96
|
-
return `${text.slice(0, maxLength - 3)}...`;
|
|
97
|
-
};
|
|
98
|
-
exports.truncateText = truncateText;
|
|
99
|
-
const toTitleCase = (text) => {
|
|
100
|
-
return text
|
|
101
|
-
.toLowerCase()
|
|
102
|
-
.split(' ')
|
|
103
|
-
.map((word) => word.charAt(0).toUpperCase() + word.slice(1))
|
|
104
|
-
.join(' ');
|
|
105
|
-
};
|
|
106
|
-
exports.toTitleCase = toTitleCase;
|
|
107
|
-
const normalizeNigerianPhone = (phone, withPlus = false) => {
|
|
108
|
-
const digits = `${phone}`.replace(/\D/g, '').trim();
|
|
109
|
-
if (digits === '') {
|
|
110
|
-
return '';
|
|
111
|
-
}
|
|
112
|
-
let normalized = digits;
|
|
113
|
-
if (digits.startsWith('234') && digits.length === 13) {
|
|
114
|
-
normalized = digits;
|
|
115
|
-
}
|
|
116
|
-
else if (digits.startsWith('0') && digits.length === 11) {
|
|
117
|
-
normalized = `234${digits.slice(1)}`;
|
|
118
|
-
}
|
|
119
|
-
else if (digits.length === 10 && /^[789]/.test(digits)) {
|
|
120
|
-
normalized = `234${digits}`;
|
|
121
|
-
}
|
|
122
|
-
else if (!digits.startsWith('234') && digits.length === 10) {
|
|
123
|
-
normalized = `234${digits}`;
|
|
124
|
-
}
|
|
125
|
-
return withPlus ? `+${normalized}` : normalized;
|
|
126
|
-
};
|
|
127
|
-
exports.normalizeNigerianPhone = normalizeNigerianPhone;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export * from './country.utils';
|
|
2
|
-
export * from './date.utils';
|
|
3
|
-
export * from './decimal.utils';
|
|
4
|
-
export * from './format.utils';
|
|
5
|
-
export * from './string.utils';
|
|
6
|
-
export * from './random.utils';
|
|
7
|
-
export * from './reference.utils';
|
|
8
|
-
export * from './validation.utils';
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./country.utils"), exports);
|
|
18
|
-
__exportStar(require("./date.utils"), exports);
|
|
19
|
-
__exportStar(require("./decimal.utils"), exports);
|
|
20
|
-
__exportStar(require("./format.utils"), exports);
|
|
21
|
-
__exportStar(require("./string.utils"), exports);
|
|
22
|
-
__exportStar(require("./random.utils"), exports);
|
|
23
|
-
__exportStar(require("./reference.utils"), exports);
|
|
24
|
-
__exportStar(require("./validation.utils"), exports);
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export interface RandomStringOptions {
|
|
2
|
-
length?: number;
|
|
3
|
-
expiry?: number;
|
|
4
|
-
caseSensitive?: boolean;
|
|
5
|
-
digits?: boolean;
|
|
6
|
-
lowerCaseAlphabets?: boolean;
|
|
7
|
-
upperCaseAlphabets?: boolean;
|
|
8
|
-
specialChars?: boolean;
|
|
9
|
-
}
|
|
10
|
-
export declare function generateRandomString(options?: RandomStringOptions): string;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.generateRandomString = generateRandomString;
|
|
4
|
-
const DIGITS = '0123456789';
|
|
5
|
-
const LOWERCASE_CHARS = 'abcdefghijklmnopqrstuvwxyz';
|
|
6
|
-
const UPPERCASE_CHARS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
|
7
|
-
const SPECIAL_CHARS = '!@#$%^&*()_+-=[]{}|;:,.<>?';
|
|
8
|
-
function generateRandomString(options = {}) {
|
|
9
|
-
const { length = 6, digits = true, lowerCaseAlphabets = false, upperCaseAlphabets = false, specialChars = false, } = options;
|
|
10
|
-
let chars = '';
|
|
11
|
-
if (digits)
|
|
12
|
-
chars += DIGITS;
|
|
13
|
-
if (lowerCaseAlphabets)
|
|
14
|
-
chars += LOWERCASE_CHARS;
|
|
15
|
-
if (upperCaseAlphabets)
|
|
16
|
-
chars += UPPERCASE_CHARS;
|
|
17
|
-
if (specialChars)
|
|
18
|
-
chars += SPECIAL_CHARS;
|
|
19
|
-
if (!chars)
|
|
20
|
-
chars = DIGITS; // Default to digits if no character set is selected
|
|
21
|
-
let result = '';
|
|
22
|
-
const charactersLength = chars.length;
|
|
23
|
-
for (let i = 0; i < length; i++) {
|
|
24
|
-
result += chars.charAt(Math.floor(Math.random() * charactersLength));
|
|
25
|
-
}
|
|
26
|
-
return result;
|
|
27
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const generateReference: (prefix?: string) => string;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.generateReference = void 0;
|
|
4
|
-
const generateRandomString = (length) => {
|
|
5
|
-
const characters = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
|
6
|
-
const charactersLength = characters.length;
|
|
7
|
-
let result = '';
|
|
8
|
-
for (let i = 0; i < length; i++) {
|
|
9
|
-
const randomIndex = Math.floor(Math.random() * charactersLength);
|
|
10
|
-
result += characters[randomIndex];
|
|
11
|
-
}
|
|
12
|
-
return result;
|
|
13
|
-
};
|
|
14
|
-
const generateReference = (prefix = 'TRX') => {
|
|
15
|
-
return `${prefix}_${generateRandomString(12)}`;
|
|
16
|
-
};
|
|
17
|
-
exports.generateReference = generateReference;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Formats phone number for display
|
|
3
|
-
* 2348012345678 → +234 801 234 5678
|
|
4
|
-
*/
|
|
5
|
-
export declare const formatPhoneNumber: (phone: string) => string;
|
|
6
|
-
/**
|
|
7
|
-
* Masks phone number for security
|
|
8
|
-
* +2348012345678 → +234****5678
|
|
9
|
-
*/
|
|
10
|
-
export declare const maskPhoneNumber: (phone: string) => string;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.maskPhoneNumber = exports.formatPhoneNumber = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Formats phone number for display
|
|
6
|
-
* 2348012345678 → +234 801 234 5678
|
|
7
|
-
*/
|
|
8
|
-
const formatPhoneNumber = (phone) => {
|
|
9
|
-
const cleaned = phone.replace(/[\s\-\(\)]/g, '');
|
|
10
|
-
// Ensure it starts with 234
|
|
11
|
-
let formatted = cleaned;
|
|
12
|
-
if (formatted.startsWith('0')) {
|
|
13
|
-
formatted = '234' + formatted.substring(1);
|
|
14
|
-
}
|
|
15
|
-
// Format as +234 801 234 5678
|
|
16
|
-
if (formatted.startsWith('234')) {
|
|
17
|
-
return `+234 ${formatted.substring(3, 6)} ${formatted.substring(6, 9)} ${formatted.substring(9)}`;
|
|
18
|
-
}
|
|
19
|
-
return phone;
|
|
20
|
-
};
|
|
21
|
-
exports.formatPhoneNumber = formatPhoneNumber;
|
|
22
|
-
/**
|
|
23
|
-
* Masks phone number for security
|
|
24
|
-
* +2348012345678 → +234****5678
|
|
25
|
-
*/
|
|
26
|
-
const maskPhoneNumber = (phone) => {
|
|
27
|
-
const cleaned = phone.replace(/[\s\-\(\)]/g, '');
|
|
28
|
-
if (cleaned.length < 8)
|
|
29
|
-
return phone;
|
|
30
|
-
const prefix = cleaned.substring(0, 4);
|
|
31
|
-
const suffix = cleaned.slice(-4);
|
|
32
|
-
return `${prefix}****${suffix}`;
|
|
33
|
-
};
|
|
34
|
-
exports.maskPhoneNumber = maskPhoneNumber;
|