Skip to content
This repository has been archived by the owner on Dec 7, 2024. It is now read-only.

Commit

Permalink
Add utility folder
Browse files Browse the repository at this point in the history
  • Loading branch information
esotericenderman committed Oct 18, 2024
1 parent f5c6fa9 commit dbf03df
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
1 change: 1 addition & 0 deletions pxt.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
},
"files": [
"src/main.ts",
"src/utility/invertObject.ts",
"README.md",
"LICENSE.md"
],
Expand Down
12 changes: 0 additions & 12 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,6 @@ const morseCode = {
let stringToSend = "";
let currentlyTypingString = "";

const invertObject = (object: {[key: string]: string}) => {
const newObject: {[key: string]: string} = {};

for (const key of Object.keys(object)) {
const value = object[key];

newObject[value] = key;
}

return newObject;
}

const invertedMorseCode = invertObject(morseCode);

const getMatch = () => {
Expand Down
11 changes: 11 additions & 0 deletions src/utility/invertObject.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const invertObject = (object: {[key: string]: string}) => {
const newObject: {[key: string]: string} = {};

for (const key of Object.keys(object)) {
const value = object[key];

newObject[value] = key;
}

return newObject;
}

0 comments on commit dbf03df

Please sign in to comment.