Stringify version prop of data
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { readdirSync, readJsonFileSync } from '../../lib/data'
|
||||
import { compareVersion } from '../../lib/string'
|
||||
|
||||
export interface ElfSkill {
|
||||
type: 'passive' | 'basic' | 'ultimate' | 'team'
|
||||
@@ -13,7 +14,7 @@ export interface ElfData {
|
||||
baseRank: number
|
||||
strengths: string[]
|
||||
skillRows: [ElfSkill[], ElfSkill[], ElfSkill[], ElfSkill[]]
|
||||
version: number
|
||||
version: string
|
||||
}
|
||||
|
||||
const elfFileNameList = readdirSync('elfs')
|
||||
@@ -27,7 +28,7 @@ const elfDataList = elfFileNameList
|
||||
.sort((a, b) => {
|
||||
let compareResult = 0
|
||||
|
||||
compareResult = -a.version + b.version
|
||||
compareResult = compareVersion(b.version, a.version)
|
||||
|
||||
if (compareResult !== 0) {
|
||||
return compareResult
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { readdirSync, readJsonFileSync } from '../../lib/data'
|
||||
import { compareVersion } from '../../lib/string'
|
||||
|
||||
export interface StigmataSkill {
|
||||
name: string
|
||||
@@ -16,7 +17,7 @@ export interface StigmataData {
|
||||
type: 'top' | 'mid' | 'bot'
|
||||
hp: number
|
||||
rarity: 3 | 4 | 5
|
||||
version?: number
|
||||
version?: string
|
||||
hidden?: boolean
|
||||
}
|
||||
|
||||
@@ -26,7 +27,7 @@ export interface StigmataSet {
|
||||
altName: string
|
||||
twoSetSkill: StigmataSkill
|
||||
threeSetSkill: StigmataSkill
|
||||
version?: number
|
||||
version?: string
|
||||
}
|
||||
|
||||
const stigmataDataFileNameList = readdirSync('stigmata')
|
||||
@@ -43,7 +44,7 @@ const stigmataList = stigmataDataFileNameList
|
||||
if (compareResult !== 0) {
|
||||
return compareResult
|
||||
}
|
||||
compareResult = (b.version || 0) - (a.version || 0)
|
||||
compareResult = compareVersion(b.version || '0.0', a.version || '0.0')
|
||||
if (compareResult !== 0) {
|
||||
return compareResult
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { readdirSync, readJsonFileSync } from '../../lib/data'
|
||||
import { compareVersion } from '../../lib/string'
|
||||
|
||||
export interface WeaponSkill {
|
||||
name: string
|
||||
@@ -22,7 +23,7 @@ export interface WeaponData {
|
||||
| 'bow'
|
||||
rarity: number
|
||||
skills: WeaponSkill[]
|
||||
version?: number
|
||||
version?: string
|
||||
}
|
||||
|
||||
const weaponsFileNameList = readdirSync('weapons')
|
||||
@@ -41,7 +42,7 @@ const weaponDataList = weaponsFileNameList
|
||||
return compareResult
|
||||
}
|
||||
|
||||
compareResult = (b.version || 0) - (a.version || 0)
|
||||
compareResult = compareVersion(b.version || '0.0', a.version || '0.0')
|
||||
if (compareResult !== 0) {
|
||||
return compareResult
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user