@ibiliaze/stringman 3.3.0 → 3.5.0
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/index.d.ts +6 -0
- package/dist/index.js +21 -1
- package/package.json +2 -2
- package/src/index.ts +22 -0
package/dist/index.d.ts
CHANGED
|
@@ -138,3 +138,9 @@ export declare const isVideoUrl: (url: string) => boolean;
|
|
|
138
138
|
* @throws Error if no endpoint returns a valid IP.
|
|
139
139
|
*/
|
|
140
140
|
export declare const getPublicIP: () => Promise<string>;
|
|
141
|
+
export declare const getTicketId: ({ fixtureId, sectionName, seatName, }: {
|
|
142
|
+
fixtureId: string;
|
|
143
|
+
sectionName: string;
|
|
144
|
+
seatName: string;
|
|
145
|
+
}) => string;
|
|
146
|
+
export declare const invalidPw: (password: string, passwordLength?: number) => string | void;
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getPublicIP = exports.isVideoUrl = exports.getRandomString = exports.extractImageSrcs = exports.select = exports.query = exports.getCloudinaryPublicId = exports.dp = exports.megaTrim = exports.superTrim = void 0;
|
|
3
|
+
exports.invalidPw = exports.getTicketId = exports.getPublicIP = exports.isVideoUrl = exports.getRandomString = exports.extractImageSrcs = exports.select = exports.query = exports.getCloudinaryPublicId = exports.dp = exports.megaTrim = exports.superTrim = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* Clean up extra whitespace in a string.
|
|
6
6
|
*
|
|
@@ -228,3 +228,23 @@ const getPublicIP = async () => {
|
|
|
228
228
|
throw new Error('Public IP unavailable');
|
|
229
229
|
};
|
|
230
230
|
exports.getPublicIP = getPublicIP;
|
|
231
|
+
const getTicketId = ({ fixtureId, sectionName, seatName, }) => `${sectionName}-${seatName}-${fixtureId}`;
|
|
232
|
+
exports.getTicketId = getTicketId;
|
|
233
|
+
const invalidPw = (password, passwordLength = 8) => {
|
|
234
|
+
try {
|
|
235
|
+
if (password.length < passwordLength)
|
|
236
|
+
`Password must be at least ${passwordLength} characters`;
|
|
237
|
+
if (!/[A-Z]/.test(password))
|
|
238
|
+
'Password must contain an uppercase letter';
|
|
239
|
+
if (!/[a-z]/.test(password))
|
|
240
|
+
'Password must contain a lowercase letter';
|
|
241
|
+
if (!/[0-9]/.test(password))
|
|
242
|
+
'Password must contain a number';
|
|
243
|
+
if (!/[!@#$%^&*(),.?":{}|<>]/.test(password))
|
|
244
|
+
'Password must contain a special character';
|
|
245
|
+
}
|
|
246
|
+
catch {
|
|
247
|
+
return 'Failed to validate password';
|
|
248
|
+
}
|
|
249
|
+
};
|
|
250
|
+
exports.invalidPw = invalidPw;
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ibiliaze/stringman",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.5.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"build": "tsc",
|
|
9
9
|
"pub": "npm publish --access public",
|
|
10
|
-
"git": "git add .; git commit -m 'changes'; git tag -a v3.
|
|
10
|
+
"git": "git add .; git commit -m 'changes'; git tag -a v3.5.0 -m 'v3.5.0'; git push origin v3.5.0; git push",
|
|
11
11
|
"push": "npm run build; npm run git; npm run pub"
|
|
12
12
|
},
|
|
13
13
|
"author": "Ibi Hasanli",
|
package/src/index.ts
CHANGED
|
@@ -227,3 +227,25 @@ export const getPublicIP = async (): Promise<string> => {
|
|
|
227
227
|
}
|
|
228
228
|
throw new Error('Public IP unavailable');
|
|
229
229
|
};
|
|
230
|
+
|
|
231
|
+
export const getTicketId = ({
|
|
232
|
+
fixtureId,
|
|
233
|
+
sectionName,
|
|
234
|
+
seatName,
|
|
235
|
+
}: {
|
|
236
|
+
fixtureId: string;
|
|
237
|
+
sectionName: string;
|
|
238
|
+
seatName: string;
|
|
239
|
+
}) => `${sectionName}-${seatName}-${fixtureId}`;
|
|
240
|
+
|
|
241
|
+
export const invalidPw = (password: string, passwordLength: number = 8): string | void => {
|
|
242
|
+
try {
|
|
243
|
+
if (password.length < passwordLength) `Password must be at least ${passwordLength} characters`;
|
|
244
|
+
if (!/[A-Z]/.test(password)) 'Password must contain an uppercase letter';
|
|
245
|
+
if (!/[a-z]/.test(password)) 'Password must contain a lowercase letter';
|
|
246
|
+
if (!/[0-9]/.test(password)) 'Password must contain a number';
|
|
247
|
+
if (!/[!@#$%^&*(),.?":{}|<>]/.test(password)) 'Password must contain a special character';
|
|
248
|
+
} catch {
|
|
249
|
+
return 'Failed to validate password';
|
|
250
|
+
}
|
|
251
|
+
};
|