Skip to content

Commit f4dcdcc

Browse files
committed
flatten files, remove unused stuff
1 parent f60304b commit f4dcdcc

19 files changed

+24
-71
lines changed
File renamed without changes.

workshop/oppgaver/01-pure-functions/pure-functions.test.ts workshop/01-pure-functions/pure-functions.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
SEK_TO_USD,
88
USD_TO_GBP,
99
} from "../constants";
10-
import { Transaction } from "../../createMockData";
10+
import { Transaction } from "../types";
1111

1212
import { convertCurrency, isCurrency, takeFirstN } from "./pure-functions";
1313

workshop/oppgaver/01-pure-functions/pure-functions.ts workshop/01-pure-functions/pure-functions.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Copilot sier:
77
*/
88

99
import { Currency } from "../constants";
10-
import { Transaction } from "../../createMockData";
10+
import { Transaction } from "../types";
1111

1212
/**
1313
* OPPGAVE 1.1: En enkel pure function

workshop/oppgaver/02-higher-order-functions/__spoilers/dontopen.ts workshop/02-higher-order-functions/__spoilers/dontopen.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Currency } from "../../constants";
2-
import { Transaction } from "../../../createMockData";
2+
import { Transaction } from "../../types";
33

44
export const isCurrency = (currency: Currency, transaction: Transaction) =>
55
transaction.currency === currency;

workshop/oppgaver/02-higher-order-functions/higher-order-functions.test.ts workshop/02-higher-order-functions/higher-order-functions.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
productsBoughtWithNOK,
66
currencyFilter,
77
} from "./higher-order-functions";
8-
import { transactions } from "../../data/transactions";
8+
import { transactions } from "../transactions";
99

1010
describe("OPPGAVE 2.1", () => {
1111
it("filters out all transactions in NOK", () => {

workshop/oppgaver/02-higher-order-functions/higher-order-functions.ts workshop/02-higher-order-functions/higher-order-functions.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Copilot sier:
55
"Higher order functions are functions that take other functions as arguments or return functions as their results."
66
*/
77

8-
import { Transaction } from "../../createMockData";
8+
import { Transaction } from "../types";
99
import { Currency } from "../constants";
1010

1111
import { isCurrency, nullableProducts } from "./__spoilers/dontopen";

workshop/oppgaver/03-currying-partial-application/__spoilers/dontopen.ts workshop/03-currying-partial-application/__spoilers/dontopen.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Currency } from "../../constants";
2-
import { Transaction } from "../../../createMockData";
2+
import { Transaction } from "../../types";
33

44
export const currencyFilter = (currency: Currency) => {
55
return (transaction: Transaction): boolean =>

workshop/oppgaver/03-currying-partial-application/currying-partial-application.test.ts workshop/03-currying-partial-application/currying-partial-application.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { it, expect, describe } from "vitest";
22

3-
import { transactions } from "../../data/transactions";
3+
import { transactions } from "../transactions";
44
import { EUR_TO_NOK } from "../constants";
55
import { currencyFilter, toAmount } from "./__spoilers/dontopen";
66

workshop/oppgaver/03-currying-partial-application/currying-partial-application.ts workshop/03-currying-partial-application/currying-partial-application.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Copilot sier:
55
"Currying is the process of transforming a function that takes multiple arguments into a function that takes them one at a time."
66
*/
77

8-
import { Transaction } from "../../createMockData";
8+
import { Transaction } from "../types";
99
import { Currency } from "../constants";
1010
import * as ExchangeRates from "../constants";
1111

workshop/oppgaver/04-compose/__spoilers/dontopen.ts workshop/04-compose/__spoilers/dontopen.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as ExchangeRates from "../../constants";
22
import { convertCurrency } from "../../03-currying-partial-application/currying-partial-application";
33
import { Currency } from "../../constants";
4-
import { Transaction } from "../../../createMockData";
4+
import { Transaction } from "../../types";
55

66
export const dkkToSek = convertCurrency(ExchangeRates.DKK_TO_SEK);
77
export const sekToUsd = convertCurrency(ExchangeRates.SEK_TO_USD);

workshop/oppgaver/04-compose/compose.test.ts workshop/04-compose/compose.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66
shoesBoughtInNok,
77
sumSalary,
88
} from "./compose";
9-
import { transactions } from "../../data/transactions";
9+
import { transactions } from "../transactions";
1010

1111
describe("OPPGAVE 4.1", () => {
1212
it("convert from DKK to SEK", () => {

workshop/oppgaver/04-compose/compose.ts workshop/04-compose/compose.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Copilot sier:
88
import { flow } from "fp-ts/function";
99
import R from "remeda";
1010
import { Currency } from "../constants";
11-
import { Transaction } from "../../createMockData";
11+
import { Transaction } from "../types";
1212
import {
1313
dkkToSek,
1414
sekToUsd,
@@ -17,7 +17,7 @@ import {
1717
eurToNok,
1818
isCurrency,
1919
} from "./__spoilers/dontopen";
20-
import { transactions } from "../../data/transactions";
20+
import { transactions } from "../transactions";
2121
import { getDate, getDay, parseISO } from "date-fns/fp";
2222

2323
/**

workshop/Oppgaver.md

-44
This file was deleted.
File renamed without changes.

workshop/helpers/generateTestTransaction.ts

-14
This file was deleted.

workshop/data/transactions.ts workshop/transactions.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Transaction } from "../createMockData";
1+
import { Transaction } from "../utils/createMockData";
22

33
export const transactions: Transaction[] = [
44
{

workshop/types.ts

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
type TransactionType = "withdrawal" | "deposit" | "salary" | "invoice" | "payment";
2+
3+
export type Transaction = {
4+
currency: string;
5+
time: string;
6+
amount: number;
7+
product?: string;
8+
merchantCountry?: string;
9+
merchantName?: string;
10+
transactionType: TransactionType;
11+
};

0 commit comments

Comments
 (0)