Skip to content

Commit

Permalink
update jsdoc.
Browse files Browse the repository at this point in the history
  • Loading branch information
dojyorin committed Apr 26, 2024
1 parent 0e1d34e commit cb4b5ca
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/deno_ext/dom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export function domValuesByName(element:Element, name:string):string[]{
}

/**
* Gets value of `.checked` in group of radio buttons.
* Get value of `.checked` in group of radio buttons.
* @example
* ```ts
* const dom = domDecode("<input type='radio' name='foo' value='1' checked><input type='radio' name='foo' value='2'>");
Expand Down
2 changes: 1 addition & 1 deletion src/pure/byte.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Concat multiple buffer sources into single binary.
* Concat multiple sources into single binary.
* @example
* ```ts
* const byte = byteConcat(new Uint8Array([1, 2, 3]), new Uint8Array([4, 5, 6]));
Expand Down
8 changes: 4 additions & 4 deletions src/pure/deep.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Make interfaces acceptable in `Record` type arguments.
* Make interface acceptable in `Record` type argument.
*/
export type Opt<T> = Partial<Record<keyof T, unknown>>;

Expand All @@ -8,7 +8,7 @@ function hasObject(data:Record<string | number | symbol, unknown>, key:string){
}

/**
* Applies `Object.freeze()` recursively.
* Apply `Object.freeze()` recursive.
* @example
* ```ts
* const freeze = deepFreeze({
Expand All @@ -18,7 +18,7 @@ function hasObject(data:Record<string | number | symbol, unknown>, key:string){
* });
* ```
*/
export function deepFreeze<T extends Opt<T>>(data:T):T{
export function deepFreeze<T extends Opt<T>>(data:T):Readonly<T>{
Object.freeze(data);

for(const key in data){
Expand All @@ -31,7 +31,7 @@ export function deepFreeze<T extends Opt<T>>(data:T):T{
}

/**
* Applies `Object.seal()` recursively.
* Apply `Object.seal()` recursive.
* @example
* ```ts
* const seal = deepSeal({
Expand Down
4 changes: 2 additions & 2 deletions src/pure/minipack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ const MINIPACK_NAME = 1;
const MINIPACK_BODY = 4;

/**
* Simple name and data pair.
* Simple name and body pair.
*/
export interface DataMap{
name: string;
body: Uint8Array;
}

/**
* Concatenate files with "minipack" format.
* Concat files with "minipack" format.
* @see https://deno.land/x/simple_utility#minipack
* @example
* ```ts
Expand Down
6 changes: 3 additions & 3 deletions src/pure/text.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export function textHexDecode(data:string):Uint8Array{
}

/**
* Trim head and tail blank, remove CR and consecutive space (tab, LF) to single space (tab, LF).
* Trim head and tail blank, remove CR and consecutive space, tab, LF to single space, tab, LF.
* @example
* ```ts
* const format = textPurgeSuperfluous(" Lorem ipsum\r dolor sit \r\r amet. ");
Expand Down Expand Up @@ -114,7 +114,7 @@ export function textFixWidth(data:string):string{
}

/**
* Clean up text with `textFixWidth()` and `textPurgeSuperfluous()`.
* Combined `textFixWidth()` and `textPurgeSuperfluous()`.
* @example
* ```ts
* const format = textGetReady("1 + 1 = 2 ");
Expand All @@ -129,7 +129,7 @@ export function textGetReady(data:string):string{
* Useful for calculate number of characters with string contains emoji.
* @example
* ```ts
* const characters = textSplitBySegment("😀😃😄😁😆😅😂🤣");
* const emojis = textSplitBySegment("😀😃😄😁😆😅😂🤣");
* ```
*/
export function textSplitBySegment(data:string):string[]{
Expand Down
8 changes: 5 additions & 3 deletions src/pure/time.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export async function delay(time:number):Promise<number>{
}

/**
* UNIX time from `Date` or formatted datetime string.
* Convert from `Date` or formatted datetime string to UNIXTIME.
* If no args will be current time.
* Note that in seconds not milliseconds.
* @example
Expand All @@ -37,7 +37,8 @@ export function timeEncode(dt?:Date | string):number{
}

/**
* `Date` from UNIX time or formatted datetime string.
* Convert from UNIXTIME or formatted datetime string to `Date`.
* If no args will be current time.
* Note that in seconds not milliseconds.
* @example
* ```ts
Expand All @@ -54,7 +55,8 @@ export function timeDecode(dt?:number | string):Date{
}

/**
* Generate serialized string from current or any `Date` or UNIX time to "yyyyMMddhhmmss".
* Serialize from `Date` or UNIXTIME or formatted datetime string to "yyyyMMddhhmmss".
* If no args will be current time.
* @example
* ```ts
* const format = timeFormatSerialize();
Expand Down
7 changes: 6 additions & 1 deletion src/pure_ext/zip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {type DataMap} from "../pure/minipack.ts";
* body: await Deno.readFile("./foo.txt")
* }];
* const zip = await zipEncode(files);
* const files = await zipDecode(zip);
* ```
*/
export async function zipEncode(files:DataMap[], pw?:string, weak?:boolean):Promise<Uint8Array>{
Expand All @@ -33,7 +34,11 @@ export async function zipEncode(files:DataMap[], pw?:string, weak?:boolean):Prom
* @see https://deno.land/x/zipjs
* @example
* ```ts
* const zip = await Deno.readFile("./foo.zip");
* const files = [{
* name: "foo.txt",
* body: await Deno.readFile("./foo.txt")
* }];
* const zip = await zipEncode(files);
* const files = await zipDecode(zip);
* ```
*/
Expand Down

0 comments on commit cb4b5ca

Please sign in to comment.