2024-01-01 21:11:32 +00:00
|
|
|
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
2022-03-01 04:25:50 +00:00
|
|
|
// This module is browser compatible.
|
2019-02-10 23:49:48 +00:00
|
|
|
|
2022-04-28 04:08:08 +00:00
|
|
|
/**
|
2024-04-16 06:59:52 +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
|
2024-05-08 07:03:08 +00:00
|
|
|
* import { concat, indexOfNeedle, endsWith } from "@std/bytes";
|
refactor(assert,async,bytes,cli,collections,crypto,csv,data-structures,datetime,dotenv,encoding,expect,fmt,front-matter,fs,html,http,ini,internal,io,json,jsonc,log,media-types,msgpack,net,path,semver,streams,testing,text,toml,ulid,url,uuid,webgpu,yaml): import from `@std/assert` (#5199)
* refactor: import from `@std/assert`
* update
2024-06-30 08:30:10 +00:00
|
|
|
* 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]);
|
2024-04-16 06:59:52 +00:00
|
|
|
*
|
2024-05-08 07:03:08 +00:00
|
|
|
* const c = concat([a, b]);
|
2024-04-16 06:59:52 +00:00
|
|
|
*
|
2024-05-08 07:03:08 +00:00
|
|
|
* assertEquals(c, new Uint8Array([0, 1, 2, 3, 4, 5]));
|
2024-04-16 06:59:52 +00:00
|
|
|
*
|
2024-05-08 07:03:08 +00:00
|
|
|
* assertEquals(indexOfNeedle(c, new Uint8Array([2, 3])), 2);
|
2024-04-16 06:59:52 +00:00
|
|
|
*
|
2024-05-08 07:03:08 +00:00
|
|
|
* assertEquals(endsWith(c, b), true);
|
2024-04-16 06:59:52 +00:00
|
|
|
* ```
|
|
|
|
*
|
2022-04-28 04:08:08 +00:00
|
|
|
* @module
|
|
|
|
*/
|
2022-11-29 06:01:21 +00:00
|
|
|
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";
|