-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
47dd740
commit e7e3bcc
Showing
8 changed files
with
147 additions
and
144 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
module.exports = { | ||
root: true, | ||
parser: '@typescript-eslint/parser', | ||
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended', 'prettier'], | ||
plugins: ['svelte3', '@typescript-eslint'], | ||
parserOptions: { | ||
sourceType: 'module', | ||
ecmaVersion: 2020 | ||
}, | ||
env: { | ||
browser: true, | ||
es2017: true | ||
} | ||
root: true, | ||
parser: '@typescript-eslint/parser', | ||
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended', 'prettier'], | ||
plugins: ['svelte3', '@typescript-eslint'], | ||
parserOptions: { | ||
sourceType: 'module', | ||
ecmaVersion: 2020 | ||
}, | ||
env: { | ||
browser: true, | ||
es2017: true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
{ | ||
"useTabs": true, | ||
"semi": false, | ||
"singleQuote": true, | ||
"trailingComma": "none", | ||
"printWidth": 100 | ||
"useTabs": false, | ||
"semi": false, | ||
"singleQuote": true, | ||
"trailingComma": "none", | ||
"printWidth": 100 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,23 @@ | ||
{ | ||
"name": "rune-decoder", | ||
"version": "0.0.1", | ||
"description": "Decode runes", | ||
"main": "dist/index.js", | ||
"scripts": { | ||
"build": "tsc", | ||
"prepare": "npm run build" | ||
}, | ||
"author": "Aaron Barnard", | ||
"license": "MIT", | ||
"devDependencies": { | ||
"@typescript-eslint/eslint-plugin": "^5.27.0", | ||
"@typescript-eslint/parser": "^5.27.0", | ||
"eslint": "^8.16.0", | ||
"eslint-config-prettier": "^8.3.0", | ||
"prettier": "^2.6.2" | ||
}, | ||
"dependencies": { | ||
"typescript": "^4.7.4" | ||
} | ||
"name": "rune-decoder", | ||
"version": "0.0.1", | ||
"description": "Decode runes", | ||
"main": "dist/index.js", | ||
"scripts": { | ||
"build": "tsc", | ||
"prepare": "npm run build" | ||
}, | ||
"types": "dist/types", | ||
"author": "Aaron Barnard", | ||
"license": "MIT", | ||
"devDependencies": { | ||
"@typescript-eslint/eslint-plugin": "^5.27.0", | ||
"@typescript-eslint/parser": "^5.27.0", | ||
"eslint": "^8.16.0", | ||
"eslint-config-prettier": "^8.3.0", | ||
"prettier": "^2.6.2" | ||
}, | ||
"dependencies": { | ||
"typescript": "^4.7.4" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
export type Restriction = { | ||
alternatives: string[] | ||
summary: string | ||
alternatives: string[] | ||
summary: string | ||
} | ||
|
||
export type DecodedRune = { | ||
id: string | ||
hash: string | ||
restrictions: Restriction[] | ||
id: string | ||
hash: string | ||
restrictions: Restriction[] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,40 @@ | ||
function i2hex(i: number) { | ||
return ('0' + i.toString(16)).slice(-2) | ||
return ('0' + i.toString(16)).slice(-2) | ||
} | ||
|
||
export const binaryHashToHex = (hash: Uint8Array): string => { | ||
return hash.reduce(function (memo, i) { | ||
return memo + i2hex(i) | ||
}, '') | ||
return hash.reduce(function (memo, i) { | ||
return memo + i2hex(i) | ||
}, '') | ||
} | ||
|
||
export const runeOperatorRegex = /[=^$/~<>{}#!]/g | ||
|
||
export const operatorToDescription = (operator: string): string => { | ||
switch (operator) { | ||
case '=': | ||
return 'is equal to' | ||
case '^': | ||
return 'starts with' | ||
case '$': | ||
return 'ends with' | ||
case '/': | ||
return 'is not equal to' | ||
case '~': | ||
return 'contains' | ||
case '<': | ||
return 'is less than' | ||
case '>': | ||
return 'is greater than' | ||
case '{': | ||
return 'sorts before' | ||
case '}': | ||
return 'sorts after' | ||
case '#': | ||
return 'comment' | ||
case '!': | ||
return 'is missing' | ||
default: | ||
return '' | ||
} | ||
switch (operator) { | ||
case '=': | ||
return 'is equal to' | ||
case '^': | ||
return 'starts with' | ||
case '$': | ||
return 'ends with' | ||
case '/': | ||
return 'is not equal to' | ||
case '~': | ||
return 'contains' | ||
case '<': | ||
return 'is less than' | ||
case '>': | ||
return 'is greater than' | ||
case '{': | ||
return 'sorts before' | ||
case '}': | ||
return 'sorts after' | ||
case '#': | ||
return 'comment' | ||
case '!': | ||
return 'is missing' | ||
default: | ||
return '' | ||
} | ||
} |