summaryrefslogtreecommitdiff
path: root/bytes/bytes.ts
diff options
context:
space:
mode:
Diffstat (limited to 'bytes/bytes.ts')
-rw-r--r--bytes/bytes.ts10
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();
}