std/bytes/mod.ts

36 lines
1020 B
TypeScript
Raw Normal View History

// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
// This module is browser compatible.
2019-02-10 23:49:48 +00:00
/**
* Helper functions for working with
* {@linkcode https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array | Uint8Array}
* byte slices.
*
2024-03-11 09:30:58 +00:00
* ```ts
* import { concat, indexOfNeedle, endsWith } from "@std/bytes";
* import { assertEquals } from "@std/assert";
2024-03-11 09:30:58 +00:00
*
* const a = new Uint8Array([0, 1, 2]);
* const b = new Uint8Array([3, 4, 5]);
*
* const c = concat([a, b]);
*
* assertEquals(c, new Uint8Array([0, 1, 2, 3, 4, 5]));
*
* assertEquals(indexOfNeedle(c, new Uint8Array([2, 3])), 2);
*
* assertEquals(endsWith(c, b), true);
* ```
*
* @module
*/
export * from "./concat.ts";
export * from "./copy.ts";
export * from "./ends_with.ts";
export * from "./equals.ts";
export * from "./includes_needle.ts";
export * from "./index_of_needle.ts";
export * from "./last_index_of_needle.ts";
export * from "./repeat.ts";
export * from "./starts_with.ts";