ingeni-validation 1.1.18 → 1.1.20

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.
@@ -333,6 +333,32 @@ async function isValidDate(value, format) {
333
333
  return true;
334
334
  }
335
335
 
336
+
337
+ //Validate Gender
338
+
339
+ async function isValidPrice(price){
340
+ if (price === null || price === undefined) return false;
341
+ if (typeof price === "boolean") return false;
342
+ if (typeof price === "string" && price.trim().length === 0) return false;
343
+ if (isNaN(price)) return false;
344
+ if (Number(price) <= 0) return false;
345
+ return true;
346
+ }
347
+
348
+
349
+ //Validate Gender
350
+
351
+ async function validateGender(gender) {
352
+ if (typeof gender !== "string") return false;
353
+
354
+ const val = gender.trim().toLowerCase();
355
+
356
+ if (val === "" || val === "null" || val === "undefined") return false;
357
+
358
+ return ["m", "f", "male", "female", "other"].includes(val);
359
+ }
360
+
361
+
336
362
  //Stop details Validation "stop_details":[{"30":["Baripada","13:00","13:01","21.9319,86.7465"]}]
337
363
 
338
364
  async function isValidStopDetails(stop_details){
@@ -538,4 +564,4 @@ async function isValidStopTime(data) {
538
564
  }
539
565
 
540
566
 
541
- export {validateMandate,validateOptional,isValidMobile,isValidEmail,isValidOtp,isValidPin,isValidNumber,isValidBoolean,checkBooleanParams,isNullValue,isValidDate,isValidTime,isValidPrice,isValidStopDetails,isValidStopTime,isValidCoordinates};
567
+ export {validateMandate,validateOptional,isValidMobile,isValidEmail,isValidOtp,isValidPin,isValidNumber,isValidBoolean,checkBooleanParams,isNullValue,isValidDate,isValidTime,isValidPrice,validateGender,isValidStopDetails,isValidStopTime,isValidCoordinates};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ingeni-validation",
3
- "version": "1.1.18",
3
+ "version": "1.1.20",
4
4
  "description": "Ingeni Validation",
5
5
  "license": "ISC",
6
6
  "author": "",