From c6505c5de6cb39b8134003658dfff43098f2993f Mon Sep 17 00:00:00 2001 From: axetroy Date: Fri, 24 May 2019 20:24:04 +0800 Subject: remove function prefix of bytes module Original: https://github.com/denoland/deno_std/commit/a4579426783f36cd5e46c4ebfb75ef702b2a15ba --- bytes/bytes.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'bytes/bytes.ts') 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(); } -- cgit v1.2.3