mirror of
https://github.com/denoland/deno.git
synced 2025-10-03 07:34:36 +00:00
remove unnecessary path.resolve in move/readJson/writeJson (denoland/deno_std#292)
Original: a00c51b05b
This commit is contained in:
parent
eaa795d477
commit
adb19cbae3
4 changed files with 16 additions and 19 deletions
|
@ -1,9 +1,7 @@
|
|||
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
||||
import * as path from "./path/mod.ts";
|
||||
|
||||
/** Reads a JSON file and then parses it into an object */
|
||||
export async function readJson(filePath: string): Promise<any> {
|
||||
filePath = path.resolve(filePath);
|
||||
const decoder = new TextDecoder("utf-8");
|
||||
|
||||
const content = decoder.decode(await Deno.readFile(filePath));
|
||||
|
@ -18,7 +16,6 @@ export async function readJson(filePath: string): Promise<any> {
|
|||
|
||||
/** Reads a JSON file and then parses it into an object */
|
||||
export function readJsonSync(filePath: string): any {
|
||||
filePath = path.resolve(filePath);
|
||||
const decoder = new TextDecoder("utf-8");
|
||||
|
||||
const content = decoder.decode(Deno.readFileSync(filePath));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue