summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorVincent LE GOFF <g_n_s@hotmail.fr>2019-03-14 15:24:54 +0100
committerRyan Dahl <ry@tinyclouds.org>2019-03-14 10:24:54 -0400
commit0b4f73cf9d6e7674c76126fc9d37defb58e7a433 (patch)
treea7f47f908cf81ea36771b537fe043d3ed17bfc34 /fs
parenta391660d2d539e3ca71418604e34df6c50dd6502 (diff)
Improve jsdoc (denoland/deno_std#277)
Original: https://github.com/denoland/deno_std/commit/1805c18ac7ed3aa6727f509ee2ec55f718ff2f61
Diffstat (limited to 'fs')
-rw-r--r--fs/empty_dir.ts6
-rw-r--r--fs/ensure_dir.ts13
-rw-r--r--fs/ensure_file.ts13
-rw-r--r--fs/exists.ts15
-rw-r--r--fs/globrex.ts16
-rw-r--r--fs/move.ts18
-rw-r--r--fs/read_json.ts14
7 files changed, 25 insertions, 70 deletions
diff --git a/fs/empty_dir.ts b/fs/empty_dir.ts
index 2ca9efb0c..72f5f9f51 100644
--- a/fs/empty_dir.ts
+++ b/fs/empty_dir.ts
@@ -4,9 +4,6 @@
* Deletes directory contents if the directory is not empty.
* If the directory does not exist, it is created.
* The directory itself is not deleted.
- * @export
- * @param {string} dir
- * @returns {Promise<void>}
*/
export async function emptyDir(dir: string): Promise<void> {
let items: Deno.FileInfo[] = [];
@@ -30,9 +27,6 @@ export async function emptyDir(dir: string): Promise<void> {
* Deletes directory contents if the directory is not empty.
* If the directory does not exist, it is created.
* The directory itself is not deleted.
- * @export
- * @param {string} dir
- * @returns {void}
*/
export function emptyDirSync(dir: string): void {
let items: Deno.FileInfo[] = [];
diff --git a/fs/ensure_dir.ts b/fs/ensure_dir.ts
index 5a5cc0a01..e7e4f69a2 100644
--- a/fs/ensure_dir.ts
+++ b/fs/ensure_dir.ts
@@ -1,9 +1,8 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
+
/**
- * Ensures that the directory exists. If the directory structure does not exist, it is created. Like mkdir -p.
- * @export
- * @param {string} dir
- * @returns {Promise<void>}
+ * Ensures that the directory exists.
+ * If the directory structure does not exist, it is created. Like mkdir -p.
*/
export async function ensureDir(dir: string): Promise<void> {
try {
@@ -16,10 +15,8 @@ export async function ensureDir(dir: string): Promise<void> {
}
/**
- * Ensures that the directory exists. If the directory structure does not exist, it is created. Like mkdir -p.
- * @export
- * @param {string} dir
- * @returns {void}
+ * Ensures that the directory exists.
+ * If the directory structure does not exist, it is created. Like mkdir -p.
*/
export function ensureDirSync(dir: string): void {
try {
diff --git a/fs/ensure_file.ts b/fs/ensure_file.ts
index ef0af5300..56632f150 100644
--- a/fs/ensure_file.ts
+++ b/fs/ensure_file.ts
@@ -1,12 +1,11 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
import * as path from "./path/mod.ts";
import { ensureDir, ensureDirSync } from "./ensure_dir.ts";
+
/**
* Ensures that the file exists.
- * If the file that is requested to be created is in directories that do not exist, these directories are created. If the file already exists, it is NOT MODIFIED.
- * @export
- * @param {string} filePath
- * @returns {Promise<void>}
+ * If the file that is requested to be created is in directories that do not exist,
+ * these directories are created. If the file already exists, it is NOT MODIFIED.
*/
export async function ensureFile(filePath: string): Promise<void> {
try {
@@ -23,10 +22,8 @@ export async function ensureFile(filePath: string): Promise<void> {
/**
* Ensures that the file exists.
- * If the file that is requested to be created is in directories that do not exist, these directories are created. If the file already exists, it is NOT MODIFIED.
- * @export
- * @param {string} filePath
- * @returns {void}
+ * If the file that is requested to be created is in directories that do not exist,
+ * these directories are created. If the file already exists, it is NOT MODIFIED.
*/
export function ensureFileSync(filePath: string): void {
try {
diff --git a/fs/exists.ts b/fs/exists.ts
index aa961037d..41961a0f2 100644
--- a/fs/exists.ts
+++ b/fs/exists.ts
@@ -1,22 +1,13 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
-/**
- * Test whether or not the given path exists by checking with the file system
- * @export
- * @param {string} filePath
- * @returns {Promise<boolean>}
- */
+
+/** Test whether or not the given path exists by checking with the file system */
export async function exists(filePath: string): Promise<boolean> {
return Deno.stat(filePath)
.then(() => true)
.catch(() => false);
}
-/**
- * Test whether or not the given path exists by checking with the file system
- * @export
- * @param {string} filePath
- * @returns {boolean}
- */
+/** Test whether or not the given path exists by checking with the file system */
export function existsSync(filePath: string): boolean {
try {
Deno.statSync(filePath);
diff --git a/fs/globrex.ts b/fs/globrex.ts
index c3cf7a337..439cea348 100644
--- a/fs/globrex.ts
+++ b/fs/globrex.ts
@@ -23,14 +23,14 @@ export interface GlobrexResult {
/**
* Convert any glob pattern to a JavaScript Regexp object
- * @param {String} glob Glob pattern to convert
- * @param {Object} opts Configuration object
- * @param {Boolean} [opts.extended=false] Support advanced ext globbing
- * @param {Boolean} [opts.globstar=false] Support globstar
- * @param {Boolean} [opts.strict=true] be laissez faire about mutiple slashes
- * @param {Boolean} [opts.filepath=''] Parse as filepath for extra path related features
- * @param {String} [opts.flags=''] RegExp globs
- * @returns {Object} converted object with string, segments and RegExp object
+ * @param glob Glob pattern to convert
+ * @param opts Configuration object
+ * @param [opts.extended=false] Support advanced ext globbing
+ * @param [opts.globstar=false] Support globstar
+ * @param [opts.strict=true] be laissez faire about mutiple slashes
+ * @param [opts.filepath=""] Parse as filepath for extra path related features
+ * @param [opts.flags=""] RegExp globs
+ * @returns Converted object with string, segments and RegExp object
*/
export function globrex(
glob: string,
diff --git a/fs/move.ts b/fs/move.ts
index f64509788..eb6352bd5 100644
--- a/fs/move.ts
+++ b/fs/move.ts
@@ -15,14 +15,7 @@ function isSrcSubdir(src: string, dest: string): boolean {
}, true);
}
-/**
- * Moves a file or directory
- * @export
- * @param {string} src
- * @param {string} dest
- * @param {MoveOptions} [options]
- * @returns {Promise<void>}
- */
+/** Moves a file or directory */
export async function move(
src: string,
dest: string,
@@ -52,14 +45,7 @@ export async function move(
return;
}
-/**
- * Moves a file or directory
- * @export
- * @param {string} src
- * @param {string} dest
- * @param {MoveOptions} [options]
- * @returns {void}
- */
+/** Moves a file or directory */
export function moveSync(
src: string,
dest: string,
diff --git a/fs/read_json.ts b/fs/read_json.ts
index d5c639ae2..1bed75078 100644
--- a/fs/read_json.ts
+++ b/fs/read_json.ts
@@ -1,12 +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
- * @param {string} filePath
- * @returns {Promise<any>}
- */
+/** 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");
@@ -21,12 +16,7 @@ export async function readJson(filePath: string): Promise<any> {
}
}
-/**
- * Reads a JSON file and then parses it into an object
- * @export
- * @param {string} filePath
- * @returns {void}
- */
+/** 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");