@availity/yup 6.0.1 → 6.0.3

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/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ## [6.0.3](https://github.com/Availity/sdk-js/compare/@availity/yup@6.0.2...@availity/yup@6.0.3) (2025-03-14)
6
+
7
+
8
+
9
+ ## [6.0.2](https://github.com/Availity/sdk-js/compare/@availity/yup@6.0.1...@availity/yup@6.0.2) (2025-03-10)
10
+
11
+
12
+
5
13
  ## [6.0.1](https://github.com/Availity/sdk-js/compare/@availity/yup@6.0.0...@availity/yup@6.0.1) (2024-10-14)
6
14
 
7
15
 
package/dist/index.js CHANGED
@@ -28,12 +28,12 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
29
 
30
30
  // src/index.ts
31
- var src_exports = {};
32
- __export(src_exports, {
31
+ var index_exports = {};
32
+ __export(index_exports, {
33
33
  avDate: () => avDate,
34
34
  dateRange: () => dateRange
35
35
  });
36
- module.exports = __toCommonJS(src_exports);
36
+ module.exports = __toCommonJS(index_exports);
37
37
  var import_yup3 = require("yup");
38
38
 
39
39
  // src/isRequired.ts
@@ -66,8 +66,7 @@ function npi(msg) {
66
66
  exclusive: true,
67
67
  message: msg || "This field is invalid.",
68
68
  test(value) {
69
- if (!value)
70
- return true;
69
+ if (!value) return true;
71
70
  value += "";
72
71
  if (!INTEGER_REGEX.test(value) || value.length !== 10) {
73
72
  return false;
@@ -108,8 +107,7 @@ function phone(msg) {
108
107
  exclusive: true,
109
108
  message: msg || "This field is invalid",
110
109
  test(value) {
111
- if (!value)
112
- return true;
110
+ if (!value) return true;
113
111
  return NANP_REGEXP.test(value);
114
112
  }
115
113
  });
@@ -260,8 +258,7 @@ var DateRangeSchema = class extends import_yup2.MixedSchema {
260
258
  name: "distance",
261
259
  exclusive: true,
262
260
  test({ endDate, startDate } = {}) {
263
- if (!minValue && !maxValue || !startDate || !endDate)
264
- return true;
261
+ if (!minValue && !maxValue || !startDate || !endDate) return true;
265
262
  if (maxValue && endDate.isAfter(startDate.add(maxValue, maxUnits), "day")) {
266
263
  return new import_yup2.ValidationError(
267
264
  maxErrorMessage || `The end date must be within ${maxValue} ${maxUnits}${maxValue > 1 ? "s" : ""} of the start date`,
@@ -293,8 +290,7 @@ var DateRangeSchema = class extends import_yup2.MixedSchema {
293
290
  exclusive: true,
294
291
  params: { min },
295
292
  test({ startDate, supportedFormats } = {}) {
296
- if (!startDate || !min)
297
- return true;
293
+ if (!startDate || !min) return true;
298
294
  const minDate = (0, import_moment2.default)(min, supportedFormats, true);
299
295
  return minDate.isValid() && minDate.isSameOrBefore(startDate);
300
296
  }
@@ -310,8 +306,7 @@ var DateRangeSchema = class extends import_yup2.MixedSchema {
310
306
  exclusive: true,
311
307
  params: { max },
312
308
  test({ endDate, supportedFormats } = {}) {
313
- if (!endDate || !max)
314
- return true;
309
+ if (!endDate || !max) return true;
315
310
  const maxDate = (0, import_moment2.default)(max, supportedFormats, true);
316
311
  return maxDate.isValid() && maxDate.isSameOrAfter(endDate);
317
312
  }
@@ -327,8 +322,7 @@ var DateRangeSchema = class extends import_yup2.MixedSchema {
327
322
  exclusive: true,
328
323
  params: { min, max },
329
324
  test({ startDate, endDate, supportedFormats } = {}) {
330
- if (!startDate || !endDate || !min || !max)
331
- return true;
325
+ if (!startDate || !endDate || !min || !max) return true;
332
326
  const minDate = (0, import_moment2.default)(min, supportedFormats, true);
333
327
  const maxDate = (0, import_moment2.default)(max, supportedFormats, true);
334
328
  return maxDate.isValid() && minDate.isValid() && maxDate.isSameOrAfter(endDate) && minDate.isSameOrBefore(startDate);
package/dist/index.mjs CHANGED
@@ -31,8 +31,7 @@ function npi(msg) {
31
31
  exclusive: true,
32
32
  message: msg || "This field is invalid.",
33
33
  test(value) {
34
- if (!value)
35
- return true;
34
+ if (!value) return true;
36
35
  value += "";
37
36
  if (!INTEGER_REGEX.test(value) || value.length !== 10) {
38
37
  return false;
@@ -73,8 +72,7 @@ function phone(msg) {
73
72
  exclusive: true,
74
73
  message: msg || "This field is invalid",
75
74
  test(value) {
76
- if (!value)
77
- return true;
75
+ if (!value) return true;
78
76
  return NANP_REGEXP.test(value);
79
77
  }
80
78
  });
@@ -225,8 +223,7 @@ var DateRangeSchema = class extends MixedSchema2 {
225
223
  name: "distance",
226
224
  exclusive: true,
227
225
  test({ endDate, startDate } = {}) {
228
- if (!minValue && !maxValue || !startDate || !endDate)
229
- return true;
226
+ if (!minValue && !maxValue || !startDate || !endDate) return true;
230
227
  if (maxValue && endDate.isAfter(startDate.add(maxValue, maxUnits), "day")) {
231
228
  return new ValidationError(
232
229
  maxErrorMessage || `The end date must be within ${maxValue} ${maxUnits}${maxValue > 1 ? "s" : ""} of the start date`,
@@ -258,8 +255,7 @@ var DateRangeSchema = class extends MixedSchema2 {
258
255
  exclusive: true,
259
256
  params: { min },
260
257
  test({ startDate, supportedFormats } = {}) {
261
- if (!startDate || !min)
262
- return true;
258
+ if (!startDate || !min) return true;
263
259
  const minDate = moment2(min, supportedFormats, true);
264
260
  return minDate.isValid() && minDate.isSameOrBefore(startDate);
265
261
  }
@@ -275,8 +271,7 @@ var DateRangeSchema = class extends MixedSchema2 {
275
271
  exclusive: true,
276
272
  params: { max },
277
273
  test({ endDate, supportedFormats } = {}) {
278
- if (!endDate || !max)
279
- return true;
274
+ if (!endDate || !max) return true;
280
275
  const maxDate = moment2(max, supportedFormats, true);
281
276
  return maxDate.isValid() && maxDate.isSameOrAfter(endDate);
282
277
  }
@@ -292,8 +287,7 @@ var DateRangeSchema = class extends MixedSchema2 {
292
287
  exclusive: true,
293
288
  params: { min, max },
294
289
  test({ startDate, endDate, supportedFormats } = {}) {
295
- if (!startDate || !endDate || !min || !max)
296
- return true;
290
+ if (!startDate || !endDate || !min || !max) return true;
297
291
  const minDate = moment2(min, supportedFormats, true);
298
292
  const maxDate = moment2(max, supportedFormats, true);
299
293
  return maxDate.isValid() && minDate.isValid() && maxDate.isSameOrAfter(endDate) && minDate.isSameOrBefore(startDate);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@availity/yup",
3
- "version": "6.0.1",
3
+ "version": "6.0.3",
4
4
  "description": "Additional methods for yup validation library",
5
5
  "keywords": [
6
6
  "yup",
@@ -22,6 +22,14 @@
22
22
  "main": "./dist/index.js",
23
23
  "module": "./dist/index.mjs",
24
24
  "types": "./dist/index.d.ts",
25
+ "exports": {
26
+ "./package.json": "./package.json",
27
+ ".": {
28
+ "types": "./dist/index.d.ts",
29
+ "import": "./dist/index.mjs",
30
+ "require": "./dist/index.js"
31
+ }
32
+ },
25
33
  "engines": {
26
34
  "node": "^18.0.0 || ^20.0.0"
27
35
  },
@@ -39,7 +47,7 @@
39
47
  },
40
48
  "devDependencies": {
41
49
  "moment": "^2.30.1",
42
- "tsup": "^7.2.0",
50
+ "tsup": "^8.4.0",
43
51
  "typescript": "^5.5.4"
44
52
  },
45
53
  "peerDependencies": {
package/project.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "name": "@availity/yup",
2
+ "name": "yup",
3
3
  "$schema": "../../node_modules/nx/schemas/project-schema.json",
4
4
  "projectType": "library",
5
5
  "targets": {
@@ -15,7 +15,7 @@
15
15
  "options": {
16
16
  "preset": "angular",
17
17
  "commitMessageFormat": "chore({projectName}): release version ${version} [skip ci]",
18
- "tagPrefix": "{projectName}@",
18
+ "tagPrefix": "@availity/{projectName}@",
19
19
  "baseBranch": "master",
20
20
  "trackDeps": true
21
21
  }