Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Dependencies #156

Merged
merged 7 commits into from
Aug 28, 2023
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ jobs:
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: "14.x"
node-version: "18.x"
- run: npm install
- run: npm test
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v16
v18
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# UNRELEASED

- Dependency Updates:
- Update prettier to v3
- Update eslint-plugin-prettier to v5
- Typescript to v5
- Node to v18

# 9.1.0

- Add additional Hiper bins (#115 thanks @upigilam)
Expand Down
2,689 changes: 1,675 additions & 1,014 deletions package-lock.json

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@
"author": "",
"license": "MIT",
"devDependencies": {
"@types/jest": "^29.4.0",
"@types/jest": "^29.5.3",
"@typescript-eslint/eslint-plugin": "^5.54.1",
"eslint": "^8.35.0",
"eslint": "^8.47.0",
"eslint-config-braintree": "^6.0.0-typescript-prep-rc.2",
"eslint-plugin-prettier": "^4.2.1",
"jest": "^29.5.0",
"prettier": "^2.8.4",
"ts-jest": "^29.0.5",
"typescript": "^4.9.5"
"eslint-plugin-prettier": "^5.0.0",
"jest": "^29.6.3",
"prettier": "^3.0.2",
"ts-jest": "^29.1.1",
"typescript": "^5.1.6"
},
"jest": {
"preset": "ts-jest",
Expand Down
16 changes: 8 additions & 8 deletions src/__tests__/add-matching-cards-to-results.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,22 +37,22 @@ describe("addMatchingCardsToResults", () => {
addMatchingCardsToResults(
"304",
createFakeCreditCardType({ patterns: [304] }),
results
results,
);
addMatchingCardsToResults(
"304",
createFakeCreditCardType({ patterns: [30] }),
results
results,
);
addMatchingCardsToResults(
"304",
createFakeCreditCardType({ patterns: [3045] }),
results
results,
);
addMatchingCardsToResults(
"304",
createFakeCreditCardType({ patterns: [3] }),
results
results,
);

expect(results.length).toBe(4);
Expand All @@ -68,22 +68,22 @@ describe("addMatchingCardsToResults", () => {
addMatchingCardsToResults(
"304",
createFakeCreditCardType({ patterns: [[304, 305]] }),
results
results,
);
addMatchingCardsToResults(
"304",
createFakeCreditCardType({ patterns: [[30, 99]] }),
results
results,
);
addMatchingCardsToResults(
"304",
createFakeCreditCardType({ patterns: [[3045, 4500]] }),
results
results,
);
addMatchingCardsToResults(
"304",
createFakeCreditCardType({ patterns: [[3, 5]] }),
results
results,
);

expect(results.length).toBe(4);
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/find-best-match.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ describe("findBestMatch", () => {
createFakeCreditCardType({ matchStrength: 4 }),
createFakeCreditCardType({}),
createFakeCreditCardType({ matchStrength: 5 }),
])
]),
).toBeNull();
});

Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { CreditCardType } from "../types";
type FakeCreditCardTypeOptions = Partial<CreditCardType>;

export function createFakeCreditCardType(
options: FakeCreditCardTypeOptions = {}
options: FakeCreditCardTypeOptions = {},
): CreditCardType {
const defaultOptions = {
niceType: "Nice Type",
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@ describe("changeOrder", () => {
describe("types", () => {
it("corresponds to internal type codes", () => {
const exposedTypes = Object.keys(creditCardType.types).map(
(key: string) => creditCardType.types[key]
(key: string) => creditCardType.types[key],
);
const internalTypes = creditCardType("").map((entry) => entry.type);

Expand Down
8 changes: 4 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@ function findType(cardType: string | number): CreditCardType {

function getAllCardTypes(): CreditCardType[] {
return testOrder.map(
(cardType) => clone(findType(cardType)) as CreditCardType
(cardType) => clone(findType(cardType)) as CreditCardType,
);
}

function getCardPosition(
name: string,
ignoreErrorForNotExisting = false
ignoreErrorForNotExisting = false,
): number {
const position = testOrder.indexOf(name);

Expand Down Expand Up @@ -113,13 +113,13 @@ creditCardType.addCard = (config: CreditCardType): void => {

creditCardType.updateCard = (
cardType: string,
updates: Partial<CreditCardType>
updates: Partial<CreditCardType>,
): void => {
const originalObject = customCards[cardType] || cardTypes[cardType];

if (!originalObject) {
throw new Error(
`"${cardType}" is not a recognized type. Use \`addCard\` instead.'`
`"${cardType}" is not a recognized type. Use \`addCard\` instead.'`,
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/lib/add-matching-cards-to-results.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type { CreditCardType } from "../types";
export function addMatchingCardsToResults(
cardNumber: string,
cardConfiguration: CreditCardType,
results: Array<CreditCardType>
results: Array<CreditCardType>,
): void {
let i, patternLength;

Expand Down
6 changes: 3 additions & 3 deletions src/lib/find-best-match.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { CreditCardType } from "../types";

function hasEnoughResultsToDetermineBestMatch(
results: CreditCardType[]
results: CreditCardType[],
): boolean {
const numberOfResultsWithMaxStrengthProperty = results.filter(
(result) => result.matchStrength
(result) => result.matchStrength,
).length;

/*
Expand All @@ -19,7 +19,7 @@ function hasEnoughResultsToDetermineBestMatch(
}

export function findBestMatch(
results: CreditCardType[]
results: CreditCardType[],
): CreditCardType | null {
if (!hasEnoughResultsToDetermineBestMatch(results)) {
return null;
Expand Down
4 changes: 2 additions & 2 deletions src/lib/matches.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
function matchesRange(
cardNumber: string,
min: number | string,
max: number | string
max: number | string,
): boolean {
const maxLengthToCheck = String(min).length;
const substr = cardNumber.substr(0, maxLengthToCheck);
Expand All @@ -31,7 +31,7 @@ function matchesPattern(cardNumber: string, pattern: string | number): boolean {

export function matches(
cardNumber: string,
pattern: string | number | string[] | number[]
pattern: string | number | string[] | number[],
): boolean {
if (Array.isArray(pattern)) {
return matchesRange(cardNumber, pattern[0], pattern[1]);
Expand Down