@mhmdhammoud/meritt-utils 1.0.5 → 1.0.6
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/lib/cypto.js +1 -1
- package/dist/lib/formatter.js +5 -3
- package/dist/lib/index.d.ts +1 -0
- package/dist/lib/index.js +3 -1
- package/dist/lib/pdf.d.ts +15 -0
- package/dist/lib/pdf.js +27 -0
- package/dist/utilities/axios.d.ts +2 -0
- package/dist/utilities/axios.js +8 -0
- package/dist/utilities/index.d.ts +1 -0
- package/dist/utilities/index.js +8 -0
- package/package.json +8 -5
- package/src/lib/cypto.ts +1 -1
- package/src/lib/formatter.ts +5 -3
- package/src/lib/index.ts +1 -0
- package/src/lib/pdf.ts +25 -0
- package/src/utilities/axios.ts +4 -0
- package/src/utilities/index.ts +1 -0
package/dist/lib/cypto.js
CHANGED
package/dist/lib/formatter.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
/*
|
|
4
|
-
Author : Mhmd Hammoud
|
|
4
|
+
Author : Mhmd Hammoud https://github.com/mhmdhammoud
|
|
5
5
|
Date : 2023-06-17
|
|
6
6
|
Description : String manipulation
|
|
7
7
|
Version : 1.0
|
|
@@ -23,7 +23,8 @@ class Formatter {
|
|
|
23
23
|
if (typeof _ !== 'string')
|
|
24
24
|
throw new Error('Provide a valid string');
|
|
25
25
|
if (withSpacing) {
|
|
26
|
-
return _.
|
|
26
|
+
return _.toLowerCase()
|
|
27
|
+
.split(' ')
|
|
27
28
|
.map((val) => val.charAt(0).toUpperCase() + val.slice(1))
|
|
28
29
|
.join(' ')
|
|
29
30
|
.replace(/ /g, '-')
|
|
@@ -31,7 +32,8 @@ class Formatter {
|
|
|
31
32
|
.replace(/\./g, '');
|
|
32
33
|
}
|
|
33
34
|
else {
|
|
34
|
-
return _.
|
|
35
|
+
return _.toLowerCase()
|
|
36
|
+
.split(' ')
|
|
35
37
|
.map((val) => val.charAt(0).toUpperCase() + val.slice(1))
|
|
36
38
|
.join(' ')
|
|
37
39
|
.replace(/\//g, '-')
|
package/dist/lib/index.d.ts
CHANGED
package/dist/lib/index.js
CHANGED
|
@@ -3,8 +3,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.Formatter = exports.Crypto = void 0;
|
|
6
|
+
exports.Pdf = exports.Formatter = exports.Crypto = void 0;
|
|
7
7
|
var cypto_1 = require("./cypto");
|
|
8
8
|
Object.defineProperty(exports, "Crypto", { enumerable: true, get: function () { return __importDefault(cypto_1).default; } });
|
|
9
9
|
var formatter_1 = require("./formatter");
|
|
10
10
|
Object.defineProperty(exports, "Formatter", { enumerable: true, get: function () { return __importDefault(formatter_1).default; } });
|
|
11
|
+
var formatter_2 = require("./formatter");
|
|
12
|
+
Object.defineProperty(exports, "Pdf", { enumerable: true, get: function () { return __importDefault(formatter_2).default; } });
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
declare class Pdf {
|
|
2
|
+
/**
|
|
3
|
+
* @remarks Convert image links into base64 format
|
|
4
|
+
* @param url - The image url
|
|
5
|
+
* @returns string
|
|
6
|
+
* @example
|
|
7
|
+
* ```typescript
|
|
8
|
+
* pdf.getBase64Images('https://fastly.picsum.photos/id/15/200/300.jpg?hmac=lozQletmrLG9PGBV1hTM1PnmvHxKEU0lAZWu8F2oL30')
|
|
9
|
+
* // => 'Hello-World'
|
|
10
|
+
* ```
|
|
11
|
+
* */
|
|
12
|
+
getBase64Images: (url: string) => string;
|
|
13
|
+
}
|
|
14
|
+
declare const pdf: Pdf;
|
|
15
|
+
export default pdf;
|
package/dist/lib/pdf.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
/*
|
|
4
|
+
Author : Mustafa Halabi https://github.com/mustafahalabi
|
|
5
|
+
Date : 2023-06-24
|
|
6
|
+
Description : Image to PDF converter
|
|
7
|
+
Version : 1.0
|
|
8
|
+
*/
|
|
9
|
+
class Pdf {
|
|
10
|
+
constructor() {
|
|
11
|
+
/**
|
|
12
|
+
* @remarks Convert image links into base64 format
|
|
13
|
+
* @param url - The image url
|
|
14
|
+
* @returns string
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* pdf.getBase64Images('https://fastly.picsum.photos/id/15/200/300.jpg?hmac=lozQletmrLG9PGBV1hTM1PnmvHxKEU0lAZWu8F2oL30')
|
|
18
|
+
* // => 'Hello-World'
|
|
19
|
+
* ```
|
|
20
|
+
* */
|
|
21
|
+
this.getBase64Images = (url) => {
|
|
22
|
+
return '';
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
const pdf = new Pdf();
|
|
27
|
+
exports.default = pdf;
|
|
@@ -0,0 +1,8 @@
|
|
|
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
|
+
const axios_1 = __importDefault(require("axios"));
|
|
7
|
+
const axiosInstance = axios_1.default.create({});
|
|
8
|
+
exports.default = axiosInstance;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as AxiosInstance } from './axios';
|
|
@@ -0,0 +1,8 @@
|
|
|
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.AxiosInstance = void 0;
|
|
7
|
+
var axios_1 = require("./axios");
|
|
8
|
+
Object.defineProperty(exports, "AxiosInstance", { enumerable: true, get: function () { return __importDefault(axios_1).default; } });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mhmdhammoud/meritt-utils",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"private": false,
|
|
@@ -22,15 +22,18 @@
|
|
|
22
22
|
"prepublish": "npm run build"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"ts-node-dev": "^1.1.8",
|
|
26
|
-
"typescript": "^4.6.3",
|
|
27
25
|
"@types/jest": "^27.5.1",
|
|
28
26
|
"@typescript-eslint/eslint-plugin": "^5.17.0",
|
|
29
27
|
"@typescript-eslint/parser": "^5.17.0",
|
|
30
28
|
"eslint": "^8.12.0",
|
|
31
29
|
"eslint-plugin-tsdoc": "^0.2.14",
|
|
32
|
-
"husky": "^8.0.0"
|
|
30
|
+
"husky": "^8.0.0",
|
|
31
|
+
"ts-node-dev": "^1.1.8",
|
|
32
|
+
"typescript": "^4.6.3"
|
|
33
33
|
},
|
|
34
34
|
"author": "Mhmdhammoud",
|
|
35
|
-
"license": "ISC"
|
|
35
|
+
"license": "ISC",
|
|
36
|
+
"dependencies": {
|
|
37
|
+
"axios": "^1.4.0"
|
|
38
|
+
}
|
|
36
39
|
}
|
package/src/lib/cypto.ts
CHANGED
package/src/lib/formatter.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Author : Mhmd Hammoud
|
|
2
|
+
Author : Mhmd Hammoud https://github.com/mhmdhammoud
|
|
3
3
|
Date : 2023-06-17
|
|
4
4
|
Description : String manipulation
|
|
5
5
|
Version : 1.0
|
|
@@ -19,14 +19,16 @@ class Formatter {
|
|
|
19
19
|
toUpperFirst = (_: string | number, withSpacing = true): string => {
|
|
20
20
|
if (typeof _ !== 'string') throw new Error('Provide a valid string')
|
|
21
21
|
if (withSpacing) {
|
|
22
|
-
return _.
|
|
22
|
+
return _.toLowerCase()
|
|
23
|
+
.split(' ')
|
|
23
24
|
.map((val: string) => val.charAt(0).toUpperCase() + val.slice(1))
|
|
24
25
|
.join(' ')
|
|
25
26
|
.replace(/ /g, '-')
|
|
26
27
|
.replace(/\//g, '-')
|
|
27
28
|
.replace(/\./g, '')
|
|
28
29
|
} else {
|
|
29
|
-
return _.
|
|
30
|
+
return _.toLowerCase()
|
|
31
|
+
.split(' ')
|
|
30
32
|
.map((val: string) => val.charAt(0).toUpperCase() + val.slice(1))
|
|
31
33
|
.join(' ')
|
|
32
34
|
.replace(/\//g, '-')
|
package/src/lib/index.ts
CHANGED
package/src/lib/pdf.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import {AxiosInstance} from '../utilities'
|
|
2
|
+
/*
|
|
3
|
+
Author : Mustafa Halabi https://github.com/mustafahalabi
|
|
4
|
+
Date : 2023-06-24
|
|
5
|
+
Description : Image to PDF converter
|
|
6
|
+
Version : 1.0
|
|
7
|
+
*/
|
|
8
|
+
class Pdf {
|
|
9
|
+
/**
|
|
10
|
+
* @remarks Convert image links into base64 format
|
|
11
|
+
* @param url - The image url
|
|
12
|
+
* @returns string
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* pdf.getBase64Images('https://fastly.picsum.photos/id/15/200/300.jpg?hmac=lozQletmrLG9PGBV1hTM1PnmvHxKEU0lAZWu8F2oL30')
|
|
16
|
+
* // => 'Hello-World'
|
|
17
|
+
* ```
|
|
18
|
+
* */
|
|
19
|
+
getBase64Images = (url: string): string => {
|
|
20
|
+
return ''
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const pdf = new Pdf()
|
|
25
|
+
export default pdf
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {default as AxiosInstance} from './axios'
|