Skip to content

Commit

Permalink
Move the docs like @param [obj.prop] to the interface. (denoland/de…
Browse files Browse the repository at this point in the history
  • Loading branch information
dsherret authored and denobot committed Feb 1, 2021
1 parent 9eadc89 commit bd3e3f8
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 38 deletions.
28 changes: 14 additions & 14 deletions encoding/csv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,20 @@ export interface HeaderOptions {

export interface ParseOptions extends ReadOptions {
header: boolean | string[] | HeaderOptions[];
/** Parse function for rows.
* Example:
* const r = await parseFile('a,b,c\ne,f,g\n', {
* header: ["this", "is", "sparta"],
* parse: (e: Record<string, unknown>) => {
* return { super: e.this, street: e.is, fighter: e.sparta };
* }
* });
* // output
* [
* { super: "a", street: "b", fighter: "c" },
* { super: "e", street: "f", fighter: "g" }
* ]
*/
parse?: (input: unknown) => unknown;
}

Expand All @@ -273,20 +287,6 @@ export interface ParseOptions extends ReadOptions {
* for columns and rows.
* @param input Input to parse. Can be a string or BufReader.
* @param opt options of the parser.
* @param [opt.header=false] HeaderOptions
* @param [opt.parse=null] Parse function for rows.
* Example:
* const r = await parseFile('a,b,c\ne,f,g\n', {
* header: ["this", "is", "sparta"],
* parse: (e: Record<string, unknown>) => {
* return { super: e.this, street: e.is, fighter: e.sparta };
* }
* });
* // output
* [
* { super: "a", street: "b", fighter: "c" },
* { super: "e", street: "f", fighter: "g" }
* ]
*/
export async function parse(
input: string | BufReader,
Expand Down
22 changes: 11 additions & 11 deletions http/cookie.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,26 @@ export interface Cookies {
}

export interface Cookie {
/** Name of the cookie. */
name: string;
/** Value of the cookie. */
value: string;
/** Expiration date of the cookie. */
expires?: Date;
/** Max-Age of the Cookie. Must be integer superior to 0. */
maxAge?: number;
/** Specifies those hosts to which the cookie will be sent. */
domain?: string;
/** Indicates a URL path that must exist in the request. */
path?: string;
/** Indicates if the cookie is made using SSL & HTTPS. */
secure?: boolean;
/** Indicates that cookie is not accessible via Javascript. **/
httpOnly?: boolean;
/** Allows servers to assert that a cookie ought not to
* be sent along with cross-site requests. */
sameSite?: SameSite;
/** Additional key value pairs with the form "key=value" */
unparsed?: string[];
}

Expand Down Expand Up @@ -95,17 +106,6 @@ export function getCookies(req: ServerRequest): Cookies {
* Set the cookie header properly in the Response
* @param res Server Response
* @param cookie Cookie to set
* @param [cookie.name] Name of the cookie
* @param [cookie.value] Value of the cookie
* @param [cookie.expires] Expiration Date of the cookie
* @param [cookie.maxAge] Max-Age of the Cookie. Must be integer superior to 0
* @param [cookie.domain] Specifies those hosts to which the cookie will be sent
* @param [cookie.path] Indicates a URL path that must exist in the request.
* @param [cookie.secure] Indicates if the cookie is made using SSL & HTTPS.
* @param [cookie.httpOnly] Indicates that cookie is not accessible via
* Javascript
* @param [cookie.sameSite] Allows servers to assert that a cookie ought not to
* be sent along with cross-site requests
* Example:
*
* setCookie(response, { name: 'deno', value: 'runtime',
Expand Down
26 changes: 13 additions & 13 deletions path/globrex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,23 @@ const GLOBSTAR_SEGMENT = `((?:[^${SEP_ESC}/]*(?:${SEP_ESC}|\/|$))*)`;
const WILDCARD_SEGMENT = `(?:[^${SEP_ESC}/]*)`;

export interface GlobrexOptions {
// Allow ExtGlob features
/** Allow ExtGlob features.
* @default false */
extended?: boolean;
// When globstar is true, '/foo/**' is equivelant
// to '/foo/*' when globstar is false.
// Having globstar set to true is the same usage as
// using wildcards in bash
/** Support globstar.
* @remarks When globstar is `true`, '/foo/**' is equivelant
* to '/foo/*' when globstar is `false`.
* Having globstar set to `true` is the same usage as
* using wildcards in bash.
* @default false */
globstar?: boolean;
// be laissez faire about mutiple slashes
/** Be laissez-faire about mutiple slashes.
* @default true */
strict?: boolean;
// Parse as filepath for extra path related features
/** Parse as filepath for extra path related features.
* @default false */
filepath?: boolean;
// Flag to use in the generated RegExp
/** Flag to use in the generated RegExp. */
flags?: string;
}

Expand All @@ -40,11 +45,6 @@ export interface GlobrexResult {
* Convert any glob pattern to a JavaScript 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(
Expand Down

0 comments on commit bd3e3f8

Please sign in to comment.