Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sync. #77

Merged
merged 58 commits into from
Sep 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
8ad81d5
Merge pull request #1 from dojyorin/dev
dojyorin Oct 13, 2022
1b847df
Merge pull request #8 from dojyorin/dev
dojyorin Oct 27, 2022
762dc66
Merge pull request #9 from dojyorin/dev
dojyorin Nov 17, 2022
ed569cb
Merge pull request #10 from dojyorin/dev
dojyorin Nov 17, 2022
cb3f38d
Merge pull request #12 from dojyorin/dev
dojyorin Nov 20, 2022
3abcedf
Merge pull request #13 from dojyorin/dev
dojyorin Nov 21, 2022
e92dad7
Merge pull request #14 from dojyorin/dev
dojyorin Nov 22, 2022
161cdcc
Merge pull request #16 from dojyorin/dev
dojyorin Nov 24, 2022
0745871
Merge pull request #17 from dojyorin/dev
dojyorin Nov 24, 2022
109e9ba
Merge pull request #19 from dojyorin/dev
dojyorin Nov 25, 2022
de09796
Merge pull request #22 from dojyorin/dev
dojyorin Nov 28, 2022
261ad8a
Merge pull request #23 from dojyorin/dev
dojyorin Nov 29, 2022
92bfe67
Merge pull request #26 from dojyorin/dev
dojyorin Dec 2, 2022
bb74d81
Merge pull request #28 from dojyorin/dev
dojyorin Dec 5, 2022
05e60de
Merge pull request #29 from dojyorin/dev
dojyorin Dec 7, 2022
3adb49f
Merge pull request #30 from dojyorin/dev
dojyorin Dec 20, 2022
511b04a
Merge pull request #31 from dojyorin/dev
dojyorin Jan 5, 2023
23356ca
Merge pull request #33 from dojyorin/dev
dojyorin Jan 15, 2023
95dd1d6
Merge pull request #34 from dojyorin/dev
dojyorin Jan 15, 2023
018c32e
Merge pull request #35 from dojyorin/dev
dojyorin Jan 26, 2023
050847a
Merge pull request #36 from dojyorin/dev
dojyorin Jan 26, 2023
0904fad
Merge pull request #37 from dojyorin/dev
dojyorin Jan 26, 2023
ee21b3e
Merge pull request #38 from dojyorin/dev
dojyorin Jan 26, 2023
9a3c26e
Merge pull request #39 from dojyorin/dev
dojyorin Jan 26, 2023
4b6ff8d
Merge pull request #40 from dojyorin/dev
dojyorin Jan 26, 2023
2bbfed1
Merge pull request #41 from dojyorin/dev
dojyorin Jan 26, 2023
170fcb3
Merge pull request #42 from dojyorin/dev
dojyorin Feb 27, 2023
d6bb004
Merge pull request #47 from dojyorin/dev
dojyorin Apr 7, 2023
b6acf15
Merge pull request #48 from dojyorin/dev
dojyorin May 18, 2023
45ef237
Merge pull request #49 from dojyorin/dev
dojyorin May 18, 2023
112a81f
Merge pull request #50 from dojyorin/dev
dojyorin May 18, 2023
d4ed314
Merge pull request #51 from dojyorin/dev
dojyorin May 19, 2023
2ba9332
Merge pull request #52 from dojyorin/dev
dojyorin May 23, 2023
25ce31f
Merge pull request #53 from dojyorin/dev
dojyorin May 31, 2023
aa135bb
Merge pull request #54 from dojyorin/dev
dojyorin May 31, 2023
3fda68d
Merge pull request #55 from dojyorin/dev
dojyorin Jun 1, 2023
c236652
Merge pull request #56 from dojyorin/dev
dojyorin Jun 1, 2023
ea1327a
Merge pull request #57 from dojyorin/dev
dojyorin Jun 2, 2023
f7acae1
Merge pull request #58 from dojyorin/dev
dojyorin Jun 2, 2023
4adff7e
Merge pull request #59 from dojyorin/dev
dojyorin Jun 8, 2023
c3fac22
Merge pull request #60 from dojyorin/dev
dojyorin Jun 8, 2023
747d7f1
Merge pull request #61 from dojyorin/dev
dojyorin Jun 28, 2023
775ec69
Merge pull request #62 from dojyorin/dev
dojyorin Jul 14, 2023
c34dd6a
Merge pull request #63 from dojyorin/dev
dojyorin Jul 14, 2023
aca34a1
Merge pull request #64 from dojyorin/dev
dojyorin Jul 15, 2023
09ea5fa
Merge pull request #65 from dojyorin/dev
dojyorin Jul 25, 2023
65dc775
Merge pull request #66 from dojyorin/dev
dojyorin Jul 25, 2023
3baa15e
Merge pull request #67 from dojyorin/dev
dojyorin Jul 27, 2023
01674bb
Merge pull request #68 from dojyorin/dev
dojyorin Jul 27, 2023
5a69eae
Merge pull request #69 from dojyorin/dev
dojyorin Jul 27, 2023
40c1718
Merge pull request #70 from dojyorin/dev
dojyorin Jul 28, 2023
5e583b3
Merge pull request #71 from dojyorin/dev
dojyorin Jul 28, 2023
02cbf2b
Merge pull request #72 from dojyorin/dev
dojyorin Aug 4, 2023
b49c568
Merge pull request #73 from dojyorin/dev
dojyorin Aug 16, 2023
8c32ac3
Merge pull request #74 from dojyorin/dev
dojyorin Sep 26, 2023
512efca
Revert "json workflow test."
dojyorin Sep 26, 2023
58b64b8
Merge pull request #75 from dojyorin/revert-74-dev
dojyorin Sep 26, 2023
558b686
Feat of v1.4.0 (#76)
dojyorin Sep 29, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
File renamed without changes.
10 changes: 10 additions & 0 deletions .github/workflows/to_yaml.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh
set -eu

while [[ ${#} -ge 1 ]]; do
if [[ -f ./${1}.json ]]; then
yq -I 4 -o y ./${1}.json | head -c -1 > ./${1}.yaml
fi

shift
done
44 changes: 0 additions & 44 deletions .github/workflows/wftest.json

This file was deleted.

6 changes: 0 additions & 6 deletions .github/workflows_json/to_yaml.sh

This file was deleted.

6 changes: 3 additions & 3 deletions deps.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export {assertEquals} from "https://deno.land/std@0.198.0/assert/mod.ts";
export {dirname, fromFileUrl} from "https://deno.land/std@0.198.0/path/mod.ts";
export {exists} from "https://deno.land/std@0.198.0/fs/mod.ts";
export {assertEquals} from "https://deno.land/std@0.203.0/assert/mod.ts";
export {dirname, fromFileUrl} from "https://deno.land/std@0.203.0/path/mod.ts";
export {exists} from "https://deno.land/std@0.203.0/fs/mod.ts";
6 changes: 3 additions & 3 deletions deps.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export {dirname, fromFileUrl} from "https://deno.land/std@0.198.0/path/mod.ts";
export {Logger, handlers} from "https://deno.land/std@0.198.0/log/mod.ts";
export {format} from "https://deno.land/std@0.198.0/datetime/mod.ts";
export {dirname, fromFileUrl} from "https://deno.land/std@0.203.0/path/mod.ts";
export {Logger, handlers} from "https://deno.land/std@0.203.0/log/mod.ts";
export {format} from "https://deno.land/std@0.203.0/datetime/mod.ts";
2 changes: 1 addition & 1 deletion mod.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import "./test/base64.test.ts";
import "./test/blob.test.ts";
import "./test/byte.test.ts";
import "./test/crypto.test.ts";
import "./test/deep.test.ts";
import "./test/deflate.test.ts";
Expand Down
2 changes: 1 addition & 1 deletion mod.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export * from "./src/base64.ts";
export * from "./src/blob.ts";
export * from "./src/byte.ts";
export * from "./src/crypto.ts";
export * from "./src/deep.ts";
export * from "./src/deflate.ts";
Expand Down
2 changes: 1 addition & 1 deletion mod.universal.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export * from "./src/base64.ts";
export * from "./src/blob.ts";
export * from "./src/byte.ts";
export * from "./src/crypto.ts";
export * from "./src/deep.ts";
export * from "./src/deflate.ts";
Expand Down
18 changes: 9 additions & 9 deletions src/base64.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
* @example
* ```ts
* const bin = await Deno.readFile("./file");
* const converted = base64Encode(bin);
* const restored = base64Decode(converted);
* const encode = b64Encode(bin);
* const decode = b64Decode(encode);
* ```
*/
export function base64Encode(data:Uint8Array):string{
export function b64Encode(data:Uint8Array):string{
return btoa([...data].map(v => String.fromCharCode(v)).join(""));
}

Expand All @@ -16,11 +16,11 @@ export function base64Encode(data:Uint8Array):string{
* @example
* ```ts
* const bin = await Deno.readFile("./file");
* const converted = base64Encode(bin);
* const restored = base64Decode(converted);
* const encode = b64Encode(bin);
* const decode = b64Decode(encode);
* ```
*/
export function base64Decode(data:string):Uint8Array{
export function b64Decode(data:string):Uint8Array{
return new Uint8Array([...atob(data)].map(v => v.charCodeAt(0)));
}

Expand All @@ -30,9 +30,9 @@ export function base64Decode(data:string):Uint8Array{
* @example
* ```ts
* const bin = await Deno.readFile("./file");
* const url = base64DataURL(bin);
* const data = b64DataURL(bin);
* ```
*/
export function base64DataURL(data:Uint8Array, mime?:string):string{
return `data:${mime ?? "application/octet-stream"};base64,${base64Encode(data)}`;
export function b64DataURL(data:Uint8Array, mime?:string):string{
return `data:${mime ?? "application/octet-stream"};base64,${b64Encode(data)}`;
}
29 changes: 0 additions & 29 deletions src/blob.ts

This file was deleted.

48 changes: 48 additions & 0 deletions src/byte.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import {b64Encode} from "./base64.ts";

/**
* Assignment of types convertible from blob.
*/
export interface BlobType{
"text": string;
"base64": string;
"byte": Uint8Array;
"buffer": ArrayBuffer;
}

/**
* Convert from blob to specified data type.
* @example
* ```ts
* const file = new File(["my-text"], "example.txt");
* const data = await blobConvert(file, "text");
* ```
*/
export async function blobConvert<T extends keyof BlobType>(blob:Blob, type:T):Promise<BlobType[T]>{
switch(type){
case "text": return <BlobType[T]>await blob.text();
case "base64": return <BlobType[T]>b64Encode(new Uint8Array(await blob.arrayBuffer()));
case "byte": return <BlobType[T]>new Uint8Array(await blob.arrayBuffer());
case "buffer": return <BlobType[T]>await blob.arrayBuffer();
default: throw new Error();
}
}

/**
* Concat multiple buffer sources into single Uint8Array.
* @example
* ```ts
* const byte = byteConcat(new Uint8Array([1, 2, 3]), new Uint8Array([4, 5, 6]));
* ```
*/
export function byteConcat(...parts:BufferSource[]):Uint8Array{
const output = new Uint8Array(parts.reduce((n, {byteLength}) => n + byteLength , 0));
let i = 0;

for(const part of parts){
output.set(new Uint8Array(part instanceof ArrayBuffer ? part : part.buffer), i);
i += part.byteLength;
}

return output;
}
Loading