@vasrefil/api-toolkit 1.0.7 → 1.0.8
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/dist/helpers/currency-formatter.helper.d.ts +1 -1
- package/dist/helpers/currency-formatter.helper.js +3 -3
- package/dist/helpers/index.d.ts +3 -0
- package/dist/helpers/index.js +19 -0
- package/dist/helpers/request.helper.d.ts +5 -0
- package/dist/helpers/request.helper.js +18 -0
- package/dist/index.d.ts +0 -1
- package/dist/index.js +2 -8
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const
|
|
1
|
+
export declare const CurrencyFmt: (value: any) => string;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
const
|
|
3
|
+
exports.CurrencyFmt = void 0;
|
|
4
|
+
const CurrencyFmt = (value) => {
|
|
5
5
|
const result = new Intl.NumberFormat('en-NG', {
|
|
6
6
|
style: 'currency',
|
|
7
7
|
currency: 'NGN',
|
|
8
8
|
}).format(value);
|
|
9
9
|
return result;
|
|
10
10
|
};
|
|
11
|
-
exports.
|
|
11
|
+
exports.CurrencyFmt = CurrencyFmt;
|
|
@@ -0,0 +1,19 @@
|
|
|
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("./currency-formatter.helper"), exports);
|
|
18
|
+
__exportStar(require("./query.helper"), exports);
|
|
19
|
+
__exportStar(require("./request.helper"), exports);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RequestHelper = void 0;
|
|
4
|
+
class RequestHelper_ {
|
|
5
|
+
get_error(error) {
|
|
6
|
+
if (error instanceof TypeError) {
|
|
7
|
+
return error.message;
|
|
8
|
+
}
|
|
9
|
+
else {
|
|
10
|
+
const url = error?.response?.config?.url || "url";
|
|
11
|
+
const data = error.response && error.response.data ? error.response.data : error;
|
|
12
|
+
// const resp = typeof(data) === 'object' ? {url, ...data} : data;
|
|
13
|
+
return data;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
const RequestHelper = new RequestHelper_;
|
|
18
|
+
exports.RequestHelper = RequestHelper;
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -17,7 +17,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
17
17
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
18
|
};
|
|
19
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
exports.customMiddleware = void 0;
|
|
21
20
|
const express_1 = __importDefault(require("express"));
|
|
22
21
|
const path_1 = __importDefault(require("path"));
|
|
23
22
|
const cors_1 = __importDefault(require("cors"));
|
|
@@ -26,6 +25,8 @@ const errorHandler = require("errorhandler");
|
|
|
26
25
|
const _config_1 = require("./models/_config");
|
|
27
26
|
const index_route_1 = require("./routes/index.route");
|
|
28
27
|
const logger_util_1 = require("./utilities/logger.util");
|
|
28
|
+
// Exports
|
|
29
|
+
__exportStar(require("./public-api"), exports);
|
|
29
30
|
// import { airbrake, airbrakeExpress } from './app-middlewares/airbrake';
|
|
30
31
|
const port = process.env.PORT || 8082;
|
|
31
32
|
const app = (0, express_1.default)();
|
|
@@ -54,10 +55,3 @@ app.use(errorHandler());
|
|
|
54
55
|
app.listen(port, () => {
|
|
55
56
|
console.log(`Server is running on port ${port}`);
|
|
56
57
|
});
|
|
57
|
-
const customMiddleware = (req, res, next) => {
|
|
58
|
-
// Your middleware logic here
|
|
59
|
-
next();
|
|
60
|
-
};
|
|
61
|
-
exports.customMiddleware = customMiddleware;
|
|
62
|
-
// Exports
|
|
63
|
-
__exportStar(require("./public-api"), exports);
|