Use JSON.parse instead of resolveJsonModule.

And fix typo.
This commit is contained in:
DitFranXX 2020-11-25 01:04:23 +09:00
parent 43e0716b85
commit e98db72efa
4 changed files with 11 additions and 5 deletions

View File

@ -1,8 +1,8 @@
import * as path from "path";
import { readXML } from './helper';
import { music } from "./mdb_ex.json"
import { readJSON, readXML } from './helper';
export async function processData() {
const { music } = await readJSON(path.resolve(__dirname, './mdb_ex.json'))
return {
music,
};

View File

@ -1,8 +1,8 @@
import * as path from "path";
import { readXML } from './helper';
import { music } from "./mdb_mt.json"
import { readJSON, readXML } from './helper';
export async function processData() {
const { music } = await readJSON(path.resolve(__dirname, './mdb_ex.json'))
return {
music,
};

View File

@ -2,4 +2,10 @@ export async function readXML(path: string) {
const xml = await IO.ReadFile(path, 'utf-8');
const json = U.parseXML(xml, false)
return json
}
export async function readJSON(path: string) {
const str = await IO.ReadFile(path, 'utf-8');
const json = JSON.parse(str)
return json
}

View File

@ -15,7 +15,7 @@ export function register() {
R.Config("custom_mdb_path", {
name: "Custom MDB PATH",
desc: "You need to enabled Custom MDB option first. USE ABSOLUTE PATH !!",
desc: "You need to enable Custom MDB option first. USE ABSOLUTE PATH !!",
type: "string",
default: "",
})