summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--datetime/mod.ts21
-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
8 files changed, 34 insertions, 82 deletions
diff --git a/datetime/mod.ts b/datetime/mod.ts
index 1e75ba4dc..a5c2648b0 100644
--- a/datetime/mod.ts
+++ b/datetime/mod.ts
@@ -3,10 +3,9 @@ export type DateFormat = "mm-dd-yyyy" | "dd-mm-yyyy" | "yyyy-mm-dd";
/**
* Parse date from string using format string
- *
- * @param {string} dateStr - date string
- * @param {DateFormat} format - format string
- * @return {Date} Parsed date
+ * @param dateStr Date string
+ * @param format Format string
+ * @return Parsed date
*/
export function parseDate(dateStr: string, format: DateFormat): Date {
let m, d, y: string;
@@ -42,10 +41,9 @@ export type DateTimeFormat =
/**
* Parse date & time from string using format string
- *
- * @param {string} dateStr - date & time string
- * @param {DateTimeFormat} format - format string
- * @return {Date} Parsed date
+ * @param dateStr Date & time string
+ * @param format Format string
+ * @return Parsed date
*/
export function parseDateTime(
datetimeStr: string,
@@ -88,9 +86,9 @@ export function parseDateTime(
/**
* Get number of the day in the year
- * @return {number} Number of the day in year
+ * @return Number of the day in year
*/
-export function dayOfYear(date: Date): any {
+export function dayOfYear(date: Date): number {
const dayMs = 1000 * 60 * 60 * 24;
const yearStart = new Date(date.getFullYear(), 0, 0);
const diff =
@@ -102,8 +100,7 @@ export function dayOfYear(date: Date): any {
/**
* Get number of current day in year
- *
- * @return {number} Number of current day in year
+ * @return Number of current day in year
*/
export function currentDayOfYear(): number {
return dayOfYear(new Date());
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");