mirror of
https://github.com/He4eT/tabswitcher.git
synced 2026-05-05 01:17:23 +00:00
pages/search: cleanup
This commit is contained in:
parent
47fae3dfa7
commit
58bd805ee3
2 changed files with 8 additions and 8 deletions
|
|
@ -4,16 +4,12 @@ const labels = {
|
|||
|
||||
const lettersOrder = 'lkjhyuionm'
|
||||
|
||||
/* */
|
||||
|
||||
const digits2label = (digits) => [...digits]
|
||||
.map((digit) => lettersOrder[digit])
|
||||
.join('')
|
||||
|
||||
const label2digits = (label) => [...label]
|
||||
.map((letter) => [...lettersOrder].findIndex((x) => x === letter))
|
||||
.join('')
|
||||
|
||||
/* */
|
||||
|
||||
export const id2label = (id, tabs) => {
|
||||
if (!labels[id]) {
|
||||
const label = Object.keys(labels).length
|
||||
|
|
@ -25,6 +21,12 @@ export const id2label = (id, tabs) => {
|
|||
return digits2label(digits)
|
||||
}
|
||||
|
||||
/* */
|
||||
|
||||
const label2digits = (label) => [...label]
|
||||
.map((letter) => [...lettersOrder].findIndex((x) => x === letter))
|
||||
.join('')
|
||||
|
||||
export const label2id = (label) => {
|
||||
const paddedDigits = label2digits(label)
|
||||
const digits = String(parseInt(paddedDigits))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue