import fs from 'fs' ; import { NsprcFile } from 'src/types' ; import { isJsonString } from './common' ; param { String } path return { ( Object | Boolean ) } export function readFile ( path ) { try { const data = fs . readFileSync ( path , 'utf8' ) ; if ( ! isJsonString ( data ) ) { return false ; } return JSON . parse ( data ) ; } catch ( err ) { return false ; } }