summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYoshiya Hinosawa <stibium121@gmail.com>2020-10-09 04:39:02 +0900
committerGitHub <noreply@github.com>2020-10-08 15:39:02 -0400
commit6897ea8ebe39b335fe268a315a89786b3af609d6 (patch)
treefee7830540420a64a2c6f12e40567fd776fe7f30
parent1cb91b7362e6c3edb0399a62958031133228a394 (diff)
docs(std/bytes): add missing docs to README (#7885)
-rw-r--r--std/bytes/README.md29
1 files changed, 29 insertions, 0 deletions
diff --git a/std/bytes/README.md b/std/bytes/README.md
index 54810762d..537c33473 100644
--- a/std/bytes/README.md
+++ b/std/bytes/README.md
@@ -58,6 +58,17 @@ hasPrefix(new Uint8Array([0, 1, 2]), new Uint8Array([0, 1])); // returns true
hasPrefix(new Uint8Array([0, 1, 2]), new Uint8Array([1, 2])); // returns false
```
+## hasSuffix
+
+Check whether binary array ends with suffix.
+
+```typescript
+import { hasSuffix } from "https://deno.land/std@$STD_VERSION/bytes/mod.ts";
+
+hasSuffix(new Uint8Array([0, 1, 2]), new Uint8Array([0, 1])); // returns false
+hasSuffix(new Uint8Array([0, 1, 2]), new Uint8Array([1, 2])); // returns true
+```
+
## repeat
Repeat bytes of given binary array and return new one.
@@ -78,6 +89,24 @@ import { concat } from "https://deno.land/std@$STD_VERSION/bytes/mod.ts";
concat(new Uint8Array([1, 2]), new Uint8Array([3, 4])); // returns Uint8Array(4) [ 1, 2, 3, 4 ]
```
+## contains
+
+Check source array contains pattern array.
+
+```typescript
+import { contains } from "https://deno.land/std@$STD_VERSION/bytes/mod.ts";
+
+contains(
+ new Uint8Array([1, 2, 0, 1, 2, 0, 2, 1, 3]),
+ new Uint8Array([0, 1, 2]),
+); // => returns true
+
+contains(
+ new Uint8Array([1, 2, 0, 1, 2, 0, 2, 1, 3]),
+ new Uint8Array([2, 2]),
+); // => returns false
+```
+
## copyBytes
Copy bytes from one binary array to another.