mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-15 10:46:32 +00:00
Change RcParser testable
This commit is contained in:
@@ -1,11 +1,11 @@
|
|||||||
import path from 'path'
|
import path from 'path'
|
||||||
import sander from 'sander'
|
import sander from 'sander'
|
||||||
|
|
||||||
function parse () {
|
|
||||||
const BOOSTNOTERC = '.boostnoterc'
|
const BOOSTNOTERC = '.boostnoterc'
|
||||||
const homePath = global.process.env.HOME || global.process.env.USERPROFILE
|
const homePath = global.process.env.HOME || global.process.env.USERPROFILE
|
||||||
const boostnotercPath = path.join(homePath, BOOSTNOTERC)
|
const _boostnotercPath = path.join(homePath, BOOSTNOTERC)
|
||||||
|
|
||||||
|
function parse (boostnotercPath = _boostnotercPath) {
|
||||||
if (!sander.existsSync(boostnotercPath)) return {}
|
if (!sander.existsSync(boostnotercPath)) return {}
|
||||||
try {
|
try {
|
||||||
return JSON.parse(sander.readFileSync(boostnotercPath).toString())
|
return JSON.parse(sander.readFileSync(boostnotercPath).toString())
|
||||||
|
|||||||
Reference in New Issue
Block a user