card-validator 10.0.3 → 10.0.4

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.
@@ -0,0 +1,47 @@
1
+ name: Bug Report
2
+ description: File a bug report.
3
+ title: "[Bug]: "
4
+ labels: ["bug", "triage"]
5
+ projects: []
6
+ body:
7
+ - type: markdown
8
+ attributes:
9
+ value: |
10
+ Thanks for taking the time to fill out this bug report!
11
+ - type: textarea
12
+ id: what-happened
13
+ attributes:
14
+ label: What happened?
15
+ description: Detail the bad behavior and the steps required to duplicate it
16
+ placeholder: Tell us what you see!
17
+ value: "A bug happened!"
18
+ validations:
19
+ required: true
20
+ - type: textarea
21
+ id: expected-behavior
22
+ attributes:
23
+ label: What did you expect to happen?
24
+ description: What did you expect to happen when performing the action?
25
+ placeholder: Expected behavior
26
+ value: "Expected behavior"
27
+ validations:
28
+ required: true
29
+ - type: input
30
+ id: version
31
+ attributes:
32
+ label: Version
33
+ description: What version of this library are you running?
34
+ placeholder: "v0.0.0"
35
+ value:
36
+ validations:
37
+ required: true
38
+ - type: textarea
39
+ id: browsers
40
+ attributes:
41
+ label: What browsers are you seeing the problem on?
42
+ description: |
43
+ List browsers where you see the problem reported. For example:
44
+ * Mac OS 15.3.5, Chrome 130.0.1234.987
45
+ * Android 14, Firefox 133.0
46
+ * iPadOS 17.1, Safari
47
+ placeholder: "For each browser specify 1) operating system and version 2) browser name and version"
@@ -0,0 +1,5 @@
1
+ blank_issues_enabled: false
2
+ contact_links:
3
+ - name: Contact Developer Support
4
+ url: https://developer.paypal.com/braintree/help
5
+ about: If you need help troubleshooting your integration, reach out to Braintree Support. Only open a GitHub issue if you've found an issue with our SDK.
@@ -0,0 +1,30 @@
1
+ name: Feature Request
2
+ description: Request a new feature.
3
+ title: "[FR]: "
4
+ labels: ["feature", "request", "enhancement", "triage"]
5
+ projects: []
6
+ body:
7
+ - type: markdown
8
+ attributes:
9
+ value: |
10
+ Thanks for taking the time to fill out this feature request!
11
+ - type: textarea
12
+ id: feat-summary
13
+ attributes:
14
+ label: Feature Summary
15
+ description: In a few sentences or less, provide a concise description of the feature being requested.
16
+ placeholder: "New feature that does ___; it can be used when ..."
17
+ validations:
18
+ required: true
19
+ - type: textarea
20
+ id: detailed-description
21
+ attributes:
22
+ label: Detailed description of new feature.
23
+ description: |
24
+ Please provide a detailed description of proposed feature.
25
+ - What problem would this new feature solve?
26
+ - How will this change affect users?
27
+ - Is it a modification to existing functionality? Are you requesting a new/modified function input or output? Please provide an example of what the change might look like?
28
+ placeholder: "New feature details."
29
+ validations:
30
+ required: true
@@ -0,0 +1,24 @@
1
+ name: Security
2
+
3
+ permissions:
4
+ contents: write # Needed by both CodeQL and dependency review
5
+ pull-requests: write # Needed by dependency review
6
+ statuses: write # Needed by dependency review (to post checks)
7
+ security-events: write # Needed by CodeQL to upload SARIF
8
+ packages: read # Needed by CodeQL for private/internal packs
9
+ actions: read # Needed by CodeQL to access internal actions
10
+
11
+ on:
12
+ pull_request:
13
+ branches: [main]
14
+ push:
15
+ branches: [main]
16
+ workflow_dispatch:
17
+
18
+ jobs:
19
+ codeql-javascript:
20
+ uses: braintree/security-workflows/.github/workflows/codeql.yml@main
21
+ with:
22
+ language: javascript-typescript
23
+ dependency-review:
24
+ uses: braintree/security-workflows/.github/workflows/dependency-review.yml@main
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.cardNumber = void 0;
3
+ exports.cardNumber = cardNumber;
4
4
  var luhn10 = require("./luhn-10");
5
5
  var getCardTypes = require("credit-card-type");
6
6
  function verification(card, isPotentiallyValid, isValid) {
@@ -51,4 +51,3 @@ function cardNumber(value, options) {
51
51
  }
52
52
  return verification(cardType, testCardValue.length < maxLength, false);
53
53
  }
54
- exports.cardNumber = cardNumber;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.cardholderName = void 0;
3
+ exports.cardholderName = cardholderName;
4
4
  var CARD_NUMBER_REGEX = /^[\d\s-]*$/;
5
5
  var MAX_LENGTH = 255;
6
6
  function verification(isValid, isPotentiallyValid) {
@@ -21,4 +21,3 @@ function cardholderName(value) {
21
21
  }
22
22
  return verification(true, true);
23
23
  }
24
- exports.cardholderName = cardholderName;
package/dist/cvv.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.cvv = void 0;
3
+ exports.cvv = cvv;
4
4
  var DEFAULT_LENGTH = 3;
5
5
  function includes(array, thing) {
6
6
  for (var i = 0; i < array.length; i++) {
@@ -41,4 +41,3 @@ function cvv(value, maxLength) {
41
41
  }
42
42
  return verification(true, true);
43
43
  }
44
- exports.cvv = cvv;
@@ -11,7 +11,7 @@ var __assign = (this && this.__assign) || function () {
11
11
  return __assign.apply(this, arguments);
12
12
  };
13
13
  Object.defineProperty(exports, "__esModule", { value: true });
14
- exports.expirationDate = void 0;
14
+ exports.expirationDate = expirationDate;
15
15
  var parse_date_1 = require("./lib/parse-date");
16
16
  var expiration_month_1 = require("./expiration-month");
17
17
  var expiration_year_1 = require("./expiration-year");
@@ -55,4 +55,3 @@ function expirationDate(value, maxElapsedYear) {
55
55
  }
56
56
  return verification(false, false, null, null);
57
57
  }
58
- exports.expirationDate = expirationDate;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.expirationMonth = void 0;
3
+ exports.expirationMonth = expirationMonth;
4
4
  function verification(isValid, isPotentiallyValid, isValidForThisYear) {
5
5
  return {
6
6
  isValid: isValid,
@@ -26,4 +26,3 @@ function expirationMonth(value) {
26
26
  var result = month > 0 && month < 13;
27
27
  return verification(result, result, result && month >= currentMonth);
28
28
  }
29
- exports.expirationMonth = expirationMonth;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.expirationYear = void 0;
3
+ exports.expirationYear = expirationYear;
4
4
  var DEFAULT_VALID_NUMBER_OF_YEARS_IN_THE_FUTURE = 19;
5
5
  function verification(isValid, isPotentiallyValid, isCurrentYear) {
6
6
  return {
@@ -55,4 +55,3 @@ function expirationYear(value, maxElapsedYear) {
55
55
  }
56
56
  return verification(valid, valid, isCurrentYear);
57
57
  }
58
- exports.expirationYear = expirationYear;
package/dist/index.js CHANGED
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  var creditCardType = __importStar(require("credit-card-type"));
26
36
  var cardholder_name_1 = require("./cardholder-name");
27
37
  var card_number_1 = require("./card-number");
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.parseDate = void 0;
3
+ exports.parseDate = parseDate;
4
4
  var expiration_year_1 = require("../expiration-year");
5
5
  var is_array_1 = require("./is-array");
6
6
  function getNumberOfMonthDigitsInDateString(dateString) {
@@ -97,4 +97,3 @@ function parseDate(datestring) {
97
97
  year: datestring.substr(month.length),
98
98
  };
99
99
  }
100
- exports.parseDate = parseDate;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.postalCode = void 0;
3
+ exports.postalCode = postalCode;
4
4
  var DEFAULT_MIN_POSTAL_CODE_LENGTH = 2;
5
5
  var ALPHANUM = new RegExp(/^[a-z0-9]+$/i);
6
6
  function verification(isValid, isPotentiallyValid) {
@@ -20,4 +20,3 @@ function postalCode(value, options) {
20
20
  }
21
21
  return verification(true, true);
22
22
  }
23
- exports.postalCode = postalCode;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "card-validator",
3
- "version": "10.0.3",
3
+ "version": "10.0.4",
4
4
  "description": "A library for validating credit card fields",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -20,20 +20,20 @@
20
20
  "author": "Braintree <code@getbraintree.com> (https://www.braintreepayments.com/)",
21
21
  "license": "MIT",
22
22
  "devDependencies": {
23
- "@types/jest": "^29.5.3",
24
- "@types/node": "^20.5.2",
23
+ "@types/jest": "^30.0.0",
24
+ "@types/node": "^25.0.3",
25
25
  "@typescript-eslint/eslint-plugin": "^5.54.1",
26
- "eslint": "^8.47.0",
26
+ "eslint": "^8.57.1",
27
27
  "eslint-config-braintree": "^6.0.0-typescript-prep-rc.2",
28
28
  "eslint-plugin-prettier": "^5.0.0",
29
- "jest": "^29.6.3",
30
- "jest-environment-jsdom": "^29.6.3",
31
- "prettier": "^3.0.2",
32
- "ts-jest": "^29.1.1",
33
- "typescript": "^5.1.6"
29
+ "jest": "^30.2.0",
30
+ "jest-environment-jsdom": "^30.2.0",
31
+ "prettier": "^3.7.4",
32
+ "ts-jest": "^29.4.6",
33
+ "typescript": "^5.9.3"
34
34
  },
35
35
  "dependencies": {
36
- "credit-card-type": "^10.0.2"
36
+ "credit-card-type": "^10.1.0"
37
37
  },
38
38
  "jest": {
39
39
  "testEnvironment": "jsdom",