@cloudstrytech/validations 1.0.0 → 1.0.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudstrytech/validations",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "JavaScript utility functions for validation",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -1,4 +1,4 @@
1
- import { parseCSV } from "./parseCSV.js";
1
+ import { parseCSV } from "./parseCsv";
2
2
  import { isValidEmail } from "../validators/emailValidator.js";
3
3
  import { isValidIndianMobile } from "../validators/mobileValidator.js";
4
4
  import { isValidDate } from "../validators/dateValidator.js";
@@ -18,11 +18,12 @@ export async function validateCSV(csvInput) {
18
18
  const errors = [];
19
19
 
20
20
  rows.forEach((row, index) => {
21
- const rowNumber = index + 2;
21
+ const rowNumber = index + 2; // header is row 1
22
22
 
23
23
  MANDATORY_FIELDS.forEach((field) => {
24
24
  const value = row[field];
25
25
 
26
+ // Empty check
26
27
  if (!value || String(value).trim() === "") {
27
28
  errors.push({
28
29
  row: rowNumber,
@@ -32,6 +33,7 @@ export async function validateCSV(csvInput) {
32
33
  return;
33
34
  }
34
35
 
36
+ // Field-specific validations
35
37
  if (field === "Email" && !isValidEmail(value)) {
36
38
  errors.push({
37
39
  row: rowNumber,