Skip to content

Commit

Permalink
upgrade to v0.17.0
Browse files Browse the repository at this point in the history
  • Loading branch information
manyuanrong committed Sep 12, 2019
1 parent 6e8d013 commit 12fbb70
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Formatting bytes(Uint8Array、Uint16Array、Uint32Array、ArrayBufferView..) out
#### code

```ts
import { format, setColorEnabled } from "https://deno.land/x/bytes_formater/mod.ts";
import { format, setColorEnabled } from "https://deno.land/x/bytes_formater@1.1.0/mod.ts";

const bytes = new Uint8Array([
10, 53, 46, 54, 46, 51, 52, 0, 71, 241, 0, 59, 77, 99, 52, 49, 65, 107,
Expand Down
4 changes: 4 additions & 0 deletions deps.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export {
setEnabled as setColorEnabled,
green
} from "https://deno.land/[email protected]/fmt/colors.ts";
2 changes: 1 addition & 1 deletion format.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

import { green } from "https://deno.land/x/std/colors/mod.ts";
import { green } from "./deps.ts";

export function format(data: ArrayBufferView) {
const bytes = new Uint8Array(data.buffer);
Expand Down
2 changes: 1 addition & 1 deletion mod.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export { format } from "./format.ts";
export { setEnabled as setColorEnabled } from "https://deno.land/x/std/colors/mod.ts";
export { setColorEnabled } from "./deps.ts";
7 changes: 4 additions & 3 deletions test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { test, runTests, assert } from "https://deno.land/x/testing/mod.ts";
import { test, runTests } from "https://deno.land/[email protected]/testing/mod.ts";
import { assertEquals } from "https://deno.land/[email protected]/testing/asserts.ts";
import { format, setColorEnabled } from "./mod.ts";

setColorEnabled(false);
Expand All @@ -22,7 +23,7 @@ test(function test1() {
|00000040| 5f 70 61 73 73 77 6f 72 64 00 |_password. |
+--------+-------------------------------------------------+----------------+`;

assert.equal(output, format(bytes).trim());
assertEquals(output, format(bytes).trim());
});

test(function test2() {
Expand All @@ -32,7 +33,7 @@ test(function test2() {
+--------+-------------------------------------------------+----------------+
|00000000| ad 94 45 00 64 c8 ae 00 4e 7a 43 00 |..E.d...NzC. |
+--------+-------------------------------------------------+----------------+`;
assert.equal(output, format(bytes).trim());
assertEquals(output, format(bytes).trim());
});

runTests();

0 comments on commit 12fbb70

Please sign in to comment.