diff options
| author | axetroy <troy450409405@gmail.com> | 2019-05-24 20:24:04 +0800 |
|---|---|---|
| committer | Ryan Dahl <ry@tinyclouds.org> | 2019-05-24 15:40:32 +0300 |
| commit | c6505c5de6cb39b8134003658dfff43098f2993f (patch) | |
| tree | 8eaf20e23ad0b7dde8b41e9fa3ded1188f90b1a8 /bytes/bytes.ts | |
| parent | 4ab0e0e9187c77244ddff11c389e0b39bda8fe4d (diff) | |
remove function prefix of bytes module
Original: https://github.com/denoland/deno_std/commit/a4579426783f36cd5e46c4ebfb75ef702b2a15ba
Diffstat (limited to 'bytes/bytes.ts')
| -rw-r--r-- | bytes/bytes.ts | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/bytes/bytes.ts b/bytes/bytes.ts index 127dad1c2..a42eaffd2 100644 --- a/bytes/bytes.ts +++ b/bytes/bytes.ts @@ -2,7 +2,7 @@ import { copyBytes } from "../io/util.ts"; /** Find first index of binary pattern from a. If not found, then return -1 **/ -export function bytesFindIndex(a: Uint8Array, pat: Uint8Array): number { +export function findIndex(a: Uint8Array, pat: Uint8Array): number { const s = pat[0]; for (let i = 0; i < a.length; i++) { if (a[i] !== s) continue; @@ -24,7 +24,7 @@ export function bytesFindIndex(a: Uint8Array, pat: Uint8Array): number { } /** Find last index of binary pattern from a. If not found, then return -1 **/ -export function bytesFindLastIndex(a: Uint8Array, pat: Uint8Array): number { +export function findLastIndex(a: Uint8Array, pat: Uint8Array): number { const e = pat[pat.length - 1]; for (let i = a.length - 1; i >= 0; i--) { if (a[i] !== e) continue; @@ -46,7 +46,7 @@ export function bytesFindLastIndex(a: Uint8Array, pat: Uint8Array): number { } /** Check whether binary arrays are equal to each other **/ -export function bytesEqual(a: Uint8Array, match: Uint8Array): boolean { +export function equal(a: Uint8Array, match: Uint8Array): boolean { if (a.length !== match.length) return false; for (let i = 0; i < match.length; i++) { if (a[i] !== match[i]) return false; @@ -55,7 +55,7 @@ export function bytesEqual(a: Uint8Array, match: Uint8Array): boolean { } /** Check whether binary array has binary prefix **/ -export function bytesHasPrefix(a: Uint8Array, prefix: Uint8Array): boolean { +export function hasPrefix(a: Uint8Array, prefix: Uint8Array): boolean { for (let i = 0, max = prefix.length; i < max; i++) { if (a[i] !== prefix[i]) return false; } @@ -67,7 +67,7 @@ export function bytesHasPrefix(a: Uint8Array, prefix: Uint8Array): boolean { * @param b The origin bytes * @param count The count you want to repeat. */ -export function bytesRepeat(b: Uint8Array, count: number): Uint8Array { +export function repeat(b: Uint8Array, count: number): Uint8Array { if (count === 0) { return new Uint8Array(); } |
