@fedify/fedify 0.8.0-dev.152 → 0.8.0-dev.154
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of @fedify/fedify might be problematic. Click here for more details.
- package/CHANGES.md +1 -0
- package/esm/deps/jsr.io/@std/bytes/{0.220.1 → 0.224.0}/concat.js +12 -8
- package/esm/deps/jsr.io/@std/bytes/0.224.0/copy.js +48 -0
- package/esm/deps/jsr.io/@std/bytes/0.224.0/ends_with.js +32 -0
- package/esm/deps/jsr.io/@std/bytes/0.224.0/equals.js +81 -0
- package/esm/deps/jsr.io/@std/bytes/0.224.0/includes_needle.js +39 -0
- package/esm/deps/jsr.io/@std/bytes/0.224.0/index_of_needle.js +66 -0
- package/esm/deps/jsr.io/@std/bytes/0.224.0/last_index_of_needle.js +63 -0
- package/esm/deps/jsr.io/@std/bytes/0.224.0/mod.js +151 -0
- package/esm/deps/jsr.io/@std/bytes/0.224.0/repeat.js +36 -0
- package/esm/deps/jsr.io/@std/bytes/0.224.0/starts_with.js +30 -0
- package/esm/deps/jsr.io/@std/encoding/{0.220.1 → 0.224.0}/base64.js +19 -2
- package/esm/deps/jsr.io/@std/encoding/{0.220.1 → 0.224.0}/hex.js +2 -7
- package/esm/deps/jsr.io/@std/semver/{0.220.1/test_range.js → 0.224.0/_test_comparator_set.js} +5 -16
- package/esm/deps/jsr.io/@std/semver/{0.220.1 → 0.224.0}/can_parse.js +1 -0
- package/esm/deps/jsr.io/@std/semver/{0.220.1 → 0.224.0}/constants.js +0 -2
- package/esm/deps/jsr.io/@std/semver/{0.220.1 → 0.224.0}/equals.js +1 -0
- package/esm/deps/jsr.io/@std/semver/{0.220.1 → 0.224.0}/format.js +2 -3
- package/esm/deps/jsr.io/@std/semver/{0.220.1 → 0.224.0}/format_range.js +3 -2
- package/esm/deps/jsr.io/@std/semver/{0.220.1 → 0.224.0}/greater_than.js +1 -0
- package/esm/deps/jsr.io/@std/semver/0.224.0/greater_than_range.js +39 -0
- package/esm/deps/jsr.io/@std/semver/{0.220.1 → 0.224.0}/increment.js +1 -0
- package/esm/deps/jsr.io/@std/semver/{0.220.1 → 0.224.0}/is_range.js +2 -2
- package/esm/deps/jsr.io/@std/semver/{0.220.1 → 0.224.0}/is_semver.js +1 -0
- package/esm/deps/jsr.io/@std/semver/0.224.0/less_than_range.js +39 -0
- package/esm/deps/jsr.io/@std/semver/{0.220.1 → 0.224.0}/max_satisfying.js +2 -2
- package/esm/deps/jsr.io/@std/semver/{0.220.1 → 0.224.0}/min_satisfying.js +2 -2
- package/esm/deps/jsr.io/@std/semver/{0.220.1 → 0.224.0}/mod.js +3 -0
- package/esm/deps/jsr.io/@std/semver/{0.220.1 → 0.224.0}/parse_range.js +2 -1
- package/esm/deps/jsr.io/@std/semver/{0.220.1 → 0.224.0}/range_intersects.js +4 -3
- package/esm/deps/jsr.io/@std/semver/{0.220.1 → 0.224.0}/range_max.js +13 -5
- package/esm/deps/jsr.io/@std/semver/{0.220.1 → 0.224.0}/range_min.js +13 -5
- package/esm/deps/jsr.io/@std/semver/0.224.0/satisfies.js +11 -0
- package/esm/deps/jsr.io/@std/semver/0.224.0/test_range.js +13 -0
- package/esm/deps/jsr.io/@std/semver/{0.220.1 → 0.224.0}/try_parse_range.js +1 -0
- package/esm/deps/jsr.io/@std/semver/{0.220.1 → 0.224.0}/types.js +1 -0
- package/esm/federation/collection.js +1 -1
- package/esm/federation/handler.js +1 -1
- package/esm/federation/send.js +7 -1
- package/esm/httpsig/mod.js +74 -17
- package/esm/nodeinfo/types.js +1 -1
- package/esm/runtime/docloader.js +1 -1
- package/esm/runtime/key.js +1 -1
- package/package.json +2 -2
- package/types/deps/jsr.io/@std/assert/0.224.0/_constants.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/assert/0.224.0/assert.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/assert/0.224.0/assert_almost_equals.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/assert/0.224.0/assert_array_includes.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/assert/0.224.0/assert_equals.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/assert/0.224.0/assert_exists.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/assert/0.224.0/assert_false.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/assert/0.224.0/assert_greater.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/assert/0.224.0/assert_greater_or_equal.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/assert/0.224.0/assert_instance_of.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/assert/0.224.0/assert_is_error.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/assert/0.224.0/assert_less.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/assert/0.224.0/assert_less_or_equal.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/assert/0.224.0/assert_match.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/assert/0.224.0/assert_not_equals.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/assert/0.224.0/assert_not_instance_of.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/assert/0.224.0/assert_not_match.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/assert/0.224.0/assert_not_strict_equals.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/assert/0.224.0/assert_object_match.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/assert/0.224.0/assert_rejects.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/assert/0.224.0/assert_strict_equals.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/assert/0.224.0/assert_string_includes.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/assert/0.224.0/assert_throws.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/assert/0.224.0/assertion_error.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/assert/0.224.0/equal.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/assert/0.224.0/fail.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/assert/0.224.0/mod.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/assert/0.224.0/unimplemented.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/assert/0.224.0/unreachable.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/async/{0.220.1 → 0.224.0}/delay.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/bytes/0.224.0/concat.d.ts +18 -0
- package/types/deps/jsr.io/@std/bytes/0.224.0/concat.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/bytes/0.224.0/copy.d.ts +39 -0
- package/types/deps/jsr.io/@std/bytes/0.224.0/copy.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/bytes/0.224.0/ends_with.d.ts +23 -0
- package/types/deps/jsr.io/@std/bytes/0.224.0/ends_with.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/bytes/0.224.0/equals.d.ts +21 -0
- package/types/deps/jsr.io/@std/bytes/0.224.0/equals.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/bytes/0.224.0/includes_needle.d.ts +35 -0
- package/types/deps/jsr.io/@std/bytes/0.224.0/includes_needle.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/bytes/0.224.0/index_of_needle.d.ts +43 -0
- package/types/deps/jsr.io/@std/bytes/0.224.0/index_of_needle.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/bytes/0.224.0/last_index_of_needle.d.ts +40 -0
- package/types/deps/jsr.io/@std/bytes/0.224.0/last_index_of_needle.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/bytes/0.224.0/mod.d.ts +150 -0
- package/types/deps/jsr.io/@std/bytes/0.224.0/mod.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/bytes/0.224.0/repeat.d.ts +24 -0
- package/types/deps/jsr.io/@std/bytes/0.224.0/repeat.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/bytes/0.224.0/starts_with.d.ts +23 -0
- package/types/deps/jsr.io/@std/bytes/0.224.0/starts_with.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/encoding/{0.220.1 → 0.224.0}/_util.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/encoding/{0.220.1 → 0.224.0}/base64.d.ts +8 -2
- package/types/deps/jsr.io/@std/encoding/0.224.0/base64.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/encoding/0.224.0/hex.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/fmt/0.224.0/colors.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/fs/{0.220.1 → 0.224.0}/_get_file_info_type.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/fs/{0.220.1 → 0.224.0}/_to_path_string.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/fs/0.224.0/ensure_dir.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/fs/0.224.0/ensure_file.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/http/{0.220.1 → 0.224.0}/_negotiation/common.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/http/{0.220.1 → 0.224.0}/_negotiation/encoding.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/http/{0.220.1 → 0.224.0}/_negotiation/language.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/http/{0.220.1 → 0.224.0}/_negotiation/media_type.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/http/{0.220.1 → 0.224.0}/negotiation.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/internal/0.224.0/diff.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/internal/0.224.0/format.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/internal/0.224.0/mod.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/{0.220.1 → 0.224.0}/_common/assert_path.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/path/{0.220.1 → 0.224.0}/_common/basename.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/path/{0.220.1 → 0.224.0}/_common/common.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/path/{0.220.1 → 0.224.0}/_common/constants.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/path/{0.220.1 → 0.224.0}/_common/dirname.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/path/{0.220.1 → 0.224.0}/_common/format.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/path/{0.220.1 → 0.224.0}/_common/from_file_url.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/path/{0.220.1 → 0.224.0}/_common/glob_to_reg_exp.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/path/{0.220.1 → 0.224.0}/_common/normalize.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/path/{0.220.1 → 0.224.0}/_common/normalize_string.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/path/{0.220.1 → 0.224.0}/_common/relative.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/path/{0.220.1 → 0.224.0}/_common/strip_trailing_separators.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/path/{0.220.1 → 0.224.0}/_common/to_file_url.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/path/0.224.0/_interface.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/{0.220.1 → 0.224.0}/_os.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/path/0.224.0/basename.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/{0.220.1 → 0.224.0}/common.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/path/{0.220.1 → 0.224.0}/constants.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/path/{0.220.1 → 0.224.0}/dirname.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/path/{0.220.1 → 0.224.0}/extname.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/path/0.224.0/format.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/{0.220.1 → 0.224.0}/from_file_url.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/path/{0.220.1 → 0.224.0}/glob_to_regexp.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/path/{0.220.1 → 0.224.0}/is_absolute.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/path/{0.220.1 → 0.224.0}/is_glob.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/path/{0.220.1 → 0.224.0}/join.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/path/{0.220.1 → 0.224.0}/join_globs.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/path/{0.220.1 → 0.224.0}/mod.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/path/{0.220.1 → 0.224.0}/normalize.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/path/{0.220.1 → 0.224.0}/normalize_glob.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/path/0.224.0/parse.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/{0.220.1 → 0.224.0}/posix/_util.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/path/{0.220.1 → 0.224.0}/posix/basename.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/path/{0.220.1 → 0.224.0}/posix/common.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/path/{0.220.1 → 0.224.0}/posix/constants.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/path/{0.220.1 → 0.224.0}/posix/dirname.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/path/{0.220.1 → 0.224.0}/posix/extname.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/path/{0.220.1 → 0.224.0}/posix/format.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/path/{0.220.1 → 0.224.0}/posix/from_file_url.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/path/{0.220.1 → 0.224.0}/posix/glob_to_regexp.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/path/{0.220.1 → 0.224.0}/posix/is_absolute.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/path/{0.220.1 → 0.224.0}/posix/is_glob.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/path/{0.220.1 → 0.224.0}/posix/join.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/path/{0.220.1 → 0.224.0}/posix/join_globs.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/path/{0.220.1 → 0.224.0}/posix/mod.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/path/{0.220.1 → 0.224.0}/posix/normalize.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/path/{0.220.1 → 0.224.0}/posix/normalize_glob.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/path/0.224.0/posix/parse.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/{0.220.1 → 0.224.0}/posix/relative.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/path/{0.220.1 → 0.224.0}/posix/resolve.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/path/{0.220.1 → 0.224.0}/posix/to_file_url.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/path/{0.220.1 → 0.224.0}/posix/to_namespaced_path.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/path/{0.220.1 → 0.224.0}/relative.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/path/{0.220.1 → 0.224.0}/resolve.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/path/{0.220.1 → 0.224.0}/to_file_url.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/path/{0.220.1 → 0.224.0}/to_namespaced_path.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/path/{0.220.1 → 0.224.0}/windows/_util.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/path/0.224.0/windows/basename.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/{0.220.1 → 0.224.0}/windows/common.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/path/{0.220.1 → 0.224.0}/windows/constants.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/path/{0.220.1 → 0.224.0}/windows/dirname.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/path/{0.220.1 → 0.224.0}/windows/extname.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/path/{0.220.1 → 0.224.0}/windows/format.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/path/{0.220.1 → 0.224.0}/windows/from_file_url.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/path/{0.220.1 → 0.224.0}/windows/glob_to_regexp.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/path/{0.220.1 → 0.224.0}/windows/is_absolute.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/path/{0.220.1 → 0.224.0}/windows/is_glob.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/path/{0.220.1 → 0.224.0}/windows/join.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/path/{0.220.1 → 0.224.0}/windows/join_globs.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/path/{0.220.1 → 0.224.0}/windows/mod.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/path/{0.220.1 → 0.224.0}/windows/normalize.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/path/{0.220.1 → 0.224.0}/windows/normalize_glob.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/path/0.224.0/windows/parse.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/{0.220.1 → 0.224.0}/windows/relative.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/path/{0.220.1 → 0.224.0}/windows/resolve.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/path/{0.220.1 → 0.224.0}/windows/to_file_url.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/path/{0.220.1 → 0.224.0}/windows/to_namespaced_path.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/semver/0.224.0/_constants.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/semver/{0.220.1 → 0.224.0}/_shared.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/semver/0.224.0/_test_comparator_set.d.ts +3 -0
- package/types/deps/jsr.io/@std/semver/0.224.0/_test_comparator_set.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/semver/0.224.0/can_parse.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/semver/0.224.0/compare.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/semver/{0.220.1 → 0.224.0}/constants.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/semver/0.224.0/difference.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/semver/0.224.0/equals.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/semver/0.224.0/format.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/semver/0.224.0/format_range.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/semver/0.224.0/greater_or_equal.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/semver/0.224.0/greater_than.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/semver/0.224.0/greater_than_range.d.ts +4 -0
- package/types/deps/jsr.io/@std/semver/0.224.0/greater_than_range.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/semver/{0.220.1 → 0.224.0}/increment.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/semver/0.224.0/is_range.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/semver/0.224.0/is_semver.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/semver/0.224.0/less_or_equal.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/semver/0.224.0/less_than.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/semver/0.224.0/less_than_range.d.ts +4 -0
- package/types/deps/jsr.io/@std/semver/0.224.0/less_than_range.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/semver/{0.220.1 → 0.224.0}/max_satisfying.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/semver/{0.220.1 → 0.224.0}/min_satisfying.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/semver/{0.220.1 → 0.224.0}/mod.d.ts +3 -0
- package/types/deps/jsr.io/@std/semver/0.224.0/mod.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/semver/0.224.0/not_equals.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/semver/0.224.0/parse.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/semver/0.224.0/parse_range.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/semver/0.224.0/range_intersects.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/semver/0.224.0/range_max.d.ts +14 -0
- package/types/deps/jsr.io/@std/semver/0.224.0/range_max.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/semver/0.224.0/range_min.d.ts +14 -0
- package/types/deps/jsr.io/@std/semver/0.224.0/range_min.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/semver/{0.220.1/test_range.d.ts → 0.224.0/satisfies.d.ts} +2 -2
- package/types/deps/jsr.io/@std/semver/0.224.0/satisfies.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/semver/0.224.0/test_range.d.ts +12 -0
- package/types/deps/jsr.io/@std/semver/0.224.0/test_range.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/semver/0.224.0/try_parse.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/semver/0.224.0/try_parse_range.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/semver/{0.220.1 → 0.224.0}/types.d.ts +0 -4
- package/types/deps/jsr.io/@std/semver/0.224.0/types.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/testing/{0.220.1 → 0.224.0}/snapshot.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/text/{0.220.1 → 0.224.0}/_util.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/text/{0.220.1 → 0.224.0}/case.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/text/{0.220.1 → 0.224.0}/closest_string.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/text/{0.220.1 → 0.224.0}/compare_similarity.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/text/0.224.0/levenshtein_distance.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/text/{0.220.1 → 0.224.0}/mod.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/text/{0.220.1 → 0.224.0}/word_similarity_sort.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/url/{0.220.1 → 0.224.0}/_strip.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/url/0.224.0/basename.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/url/0.224.0/dirname.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/url/0.224.0/extname.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/url/0.224.0/join.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/url/0.224.0/mod.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/url/{0.220.1 → 0.224.0}/normalize.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/yaml/{0.220.1 → 0.224.0}/_dumper/dumper.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/yaml/{0.220.1 → 0.224.0}/_dumper/dumper_state.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/yaml/{0.220.1 → 0.224.0}/_error.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/yaml/{0.220.1 → 0.224.0}/_loader/loader.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/yaml/{0.220.1 → 0.224.0}/_loader/loader_state.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/yaml/{0.220.1 → 0.224.0}/_mark.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/yaml/{0.220.1 → 0.224.0}/_state.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/yaml/{0.220.1 → 0.224.0}/_type/binary.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/yaml/{0.220.1 → 0.224.0}/_type/bool.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/yaml/{0.220.1 → 0.224.0}/_type/float.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/yaml/{0.220.1 → 0.224.0}/_type/function.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/yaml/{0.220.1 → 0.224.0}/_type/int.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/yaml/{0.220.1 → 0.224.0}/_type/map.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/yaml/{0.220.1 → 0.224.0}/_type/merge.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/yaml/{0.220.1 → 0.224.0}/_type/mod.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/yaml/{0.220.1 → 0.224.0}/_type/nil.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/yaml/{0.220.1 → 0.224.0}/_type/omap.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/yaml/{0.220.1 → 0.224.0}/_type/pairs.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/yaml/{0.220.1 → 0.224.0}/_type/regexp.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/yaml/{0.220.1 → 0.224.0}/_type/seq.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/yaml/{0.220.1 → 0.224.0}/_type/set.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/yaml/{0.220.1 → 0.224.0}/_type/str.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/yaml/{0.220.1 → 0.224.0}/_type/timestamp.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/yaml/{0.220.1 → 0.224.0}/_type/undefined.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/yaml/{0.220.1 → 0.224.0}/_utils.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/yaml/{0.220.1 → 0.224.0}/mod.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/yaml/{0.220.1 → 0.224.0}/parse.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/yaml/0.224.0/schema/core.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/yaml/0.224.0/schema/default.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/yaml/{0.220.1 → 0.224.0}/schema/extended.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/yaml/0.224.0/schema/failsafe.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/yaml/{0.220.1 → 0.224.0}/schema/json.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/yaml/0.224.0/schema/mod.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/yaml/{0.220.1 → 0.224.0}/schema.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/yaml/{0.220.1 → 0.224.0}/stringify.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/yaml/{0.220.1 → 0.224.0}/type.d.ts.map +1 -1
- package/types/federation/send.d.ts.map +1 -1
- package/types/httpsig/mod.d.ts.map +1 -1
- package/types/nodeinfo/types.d.ts +1 -1
- package/esm/deps/jsr.io/@std/bytes/0.220.1/copy.js +0 -37
- package/esm/deps/jsr.io/@std/bytes/0.220.1/ends_with.js +0 -23
- package/esm/deps/jsr.io/@std/bytes/0.220.1/equals.js +0 -44
- package/esm/deps/jsr.io/@std/bytes/0.220.1/includes_needle.js +0 -21
- package/esm/deps/jsr.io/@std/bytes/0.220.1/index_of_needle.js +0 -45
- package/esm/deps/jsr.io/@std/bytes/0.220.1/last_index_of_needle.js +0 -45
- package/esm/deps/jsr.io/@std/bytes/0.220.1/mod.js +0 -25
- package/esm/deps/jsr.io/@std/bytes/0.220.1/repeat.js +0 -33
- package/esm/deps/jsr.io/@std/bytes/0.220.1/starts_with.js +0 -21
- package/types/deps/jsr.io/@std/bytes/0.220.1/concat.d.ts +0 -14
- package/types/deps/jsr.io/@std/bytes/0.220.1/concat.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/bytes/0.220.1/copy.d.ts +0 -28
- package/types/deps/jsr.io/@std/bytes/0.220.1/copy.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/bytes/0.220.1/ends_with.d.ts +0 -14
- package/types/deps/jsr.io/@std/bytes/0.220.1/ends_with.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/bytes/0.220.1/equals.d.ts +0 -6
- package/types/deps/jsr.io/@std/bytes/0.220.1/equals.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/bytes/0.220.1/includes_needle.d.ts +0 -17
- package/types/deps/jsr.io/@std/bytes/0.220.1/includes_needle.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/bytes/0.220.1/index_of_needle.d.ts +0 -18
- package/types/deps/jsr.io/@std/bytes/0.220.1/index_of_needle.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/bytes/0.220.1/last_index_of_needle.d.ts +0 -18
- package/types/deps/jsr.io/@std/bytes/0.220.1/last_index_of_needle.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/bytes/0.220.1/mod.d.ts +0 -24
- package/types/deps/jsr.io/@std/bytes/0.220.1/mod.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/bytes/0.220.1/repeat.d.ts +0 -15
- package/types/deps/jsr.io/@std/bytes/0.220.1/repeat.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/bytes/0.220.1/starts_with.d.ts +0 -14
- package/types/deps/jsr.io/@std/bytes/0.220.1/starts_with.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/encoding/0.220.1/base64.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/encoding/0.220.1/hex.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/fs/0.220.1/ensure_dir.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/fs/0.220.1/ensure_file.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/path/0.220.1/_interface.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/path/0.220.1/basename.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/path/0.220.1/format.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/path/0.220.1/parse.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/path/0.220.1/posix/parse.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/path/0.220.1/windows/basename.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/path/0.220.1/windows/parse.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/semver/0.220.1/_constants.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/semver/0.220.1/can_parse.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/semver/0.220.1/compare.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/semver/0.220.1/difference.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/semver/0.220.1/equals.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/semver/0.220.1/format.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/semver/0.220.1/format_range.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/semver/0.220.1/greater_or_equal.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/semver/0.220.1/greater_than.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/semver/0.220.1/is_range.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/semver/0.220.1/is_semver.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/semver/0.220.1/less_or_equal.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/semver/0.220.1/less_than.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/semver/0.220.1/mod.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/semver/0.220.1/not_equals.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/semver/0.220.1/parse.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/semver/0.220.1/parse_range.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/semver/0.220.1/range_intersects.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/semver/0.220.1/range_max.d.ts +0 -8
- package/types/deps/jsr.io/@std/semver/0.220.1/range_max.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/semver/0.220.1/range_min.d.ts +0 -8
- package/types/deps/jsr.io/@std/semver/0.220.1/range_min.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/semver/0.220.1/test_range.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/semver/0.220.1/try_parse.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/semver/0.220.1/try_parse_range.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/semver/0.220.1/types.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/text/0.220.1/levenshtein_distance.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/url/0.220.1/basename.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/url/0.220.1/dirname.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/url/0.220.1/extname.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/url/0.220.1/join.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/url/0.220.1/mod.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/yaml/0.220.1/schema/core.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/yaml/0.220.1/schema/default.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/yaml/0.220.1/schema/failsafe.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/yaml/0.220.1/schema/mod.d.ts.map +0 -1
- /package/esm/deps/jsr.io/@std/encoding/{0.220.1 → 0.224.0}/_util.js +0 -0
- /package/esm/deps/jsr.io/@std/http/{0.220.1 → 0.224.0}/_negotiation/common.js +0 -0
- /package/esm/deps/jsr.io/@std/http/{0.220.1 → 0.224.0}/_negotiation/encoding.js +0 -0
- /package/esm/deps/jsr.io/@std/http/{0.220.1 → 0.224.0}/_negotiation/language.js +0 -0
- /package/esm/deps/jsr.io/@std/http/{0.220.1 → 0.224.0}/_negotiation/media_type.js +0 -0
- /package/esm/deps/jsr.io/@std/http/{0.220.1 → 0.224.0}/negotiation.js +0 -0
- /package/esm/deps/jsr.io/@std/semver/{0.220.1 → 0.224.0}/_constants.js +0 -0
- /package/esm/deps/jsr.io/@std/semver/{0.220.1 → 0.224.0}/_shared.js +0 -0
- /package/esm/deps/jsr.io/@std/semver/{0.220.1 → 0.224.0}/compare.js +0 -0
- /package/esm/deps/jsr.io/@std/semver/{0.220.1 → 0.224.0}/difference.js +0 -0
- /package/esm/deps/jsr.io/@std/semver/{0.220.1 → 0.224.0}/greater_or_equal.js +0 -0
- /package/esm/deps/jsr.io/@std/semver/{0.220.1 → 0.224.0}/less_or_equal.js +0 -0
- /package/esm/deps/jsr.io/@std/semver/{0.220.1 → 0.224.0}/less_than.js +0 -0
- /package/esm/deps/jsr.io/@std/semver/{0.220.1 → 0.224.0}/not_equals.js +0 -0
- /package/esm/deps/jsr.io/@std/semver/{0.220.1 → 0.224.0}/parse.js +0 -0
- /package/esm/deps/jsr.io/@std/semver/{0.220.1 → 0.224.0}/try_parse.js +0 -0
- /package/types/deps/jsr.io/@std/encoding/{0.220.1 → 0.224.0}/_util.d.ts +0 -0
- /package/types/deps/jsr.io/@std/encoding/{0.220.1 → 0.224.0}/hex.d.ts +0 -0
- /package/types/deps/jsr.io/@std/http/{0.220.1 → 0.224.0}/_negotiation/common.d.ts +0 -0
- /package/types/deps/jsr.io/@std/http/{0.220.1 → 0.224.0}/_negotiation/encoding.d.ts +0 -0
- /package/types/deps/jsr.io/@std/http/{0.220.1 → 0.224.0}/_negotiation/language.d.ts +0 -0
- /package/types/deps/jsr.io/@std/http/{0.220.1 → 0.224.0}/_negotiation/media_type.d.ts +0 -0
- /package/types/deps/jsr.io/@std/http/{0.220.1 → 0.224.0}/negotiation.d.ts +0 -0
- /package/types/deps/jsr.io/@std/semver/{0.220.1 → 0.224.0}/_constants.d.ts +0 -0
- /package/types/deps/jsr.io/@std/semver/{0.220.1 → 0.224.0}/_shared.d.ts +0 -0
- /package/types/deps/jsr.io/@std/semver/{0.220.1 → 0.224.0}/can_parse.d.ts +0 -0
- /package/types/deps/jsr.io/@std/semver/{0.220.1 → 0.224.0}/compare.d.ts +0 -0
- /package/types/deps/jsr.io/@std/semver/{0.220.1 → 0.224.0}/constants.d.ts +0 -0
- /package/types/deps/jsr.io/@std/semver/{0.220.1 → 0.224.0}/difference.d.ts +0 -0
- /package/types/deps/jsr.io/@std/semver/{0.220.1 → 0.224.0}/equals.d.ts +0 -0
- /package/types/deps/jsr.io/@std/semver/{0.220.1 → 0.224.0}/format.d.ts +0 -0
- /package/types/deps/jsr.io/@std/semver/{0.220.1 → 0.224.0}/format_range.d.ts +0 -0
- /package/types/deps/jsr.io/@std/semver/{0.220.1 → 0.224.0}/greater_or_equal.d.ts +0 -0
- /package/types/deps/jsr.io/@std/semver/{0.220.1 → 0.224.0}/greater_than.d.ts +0 -0
- /package/types/deps/jsr.io/@std/semver/{0.220.1 → 0.224.0}/increment.d.ts +0 -0
- /package/types/deps/jsr.io/@std/semver/{0.220.1 → 0.224.0}/is_range.d.ts +0 -0
- /package/types/deps/jsr.io/@std/semver/{0.220.1 → 0.224.0}/is_semver.d.ts +0 -0
- /package/types/deps/jsr.io/@std/semver/{0.220.1 → 0.224.0}/less_or_equal.d.ts +0 -0
- /package/types/deps/jsr.io/@std/semver/{0.220.1 → 0.224.0}/less_than.d.ts +0 -0
- /package/types/deps/jsr.io/@std/semver/{0.220.1 → 0.224.0}/max_satisfying.d.ts +0 -0
- /package/types/deps/jsr.io/@std/semver/{0.220.1 → 0.224.0}/min_satisfying.d.ts +0 -0
- /package/types/deps/jsr.io/@std/semver/{0.220.1 → 0.224.0}/not_equals.d.ts +0 -0
- /package/types/deps/jsr.io/@std/semver/{0.220.1 → 0.224.0}/parse.d.ts +0 -0
- /package/types/deps/jsr.io/@std/semver/{0.220.1 → 0.224.0}/parse_range.d.ts +0 -0
- /package/types/deps/jsr.io/@std/semver/{0.220.1 → 0.224.0}/range_intersects.d.ts +0 -0
- /package/types/deps/jsr.io/@std/semver/{0.220.1 → 0.224.0}/try_parse.d.ts +0 -0
- /package/types/deps/jsr.io/@std/semver/{0.220.1 → 0.224.0}/try_parse_range.d.ts +0 -0
package/CHANGES.md
CHANGED
@@ -1,27 +1,31 @@
|
|
1
1
|
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
2
2
|
// This module is browser compatible.
|
3
3
|
/**
|
4
|
-
* Concatenate an array of
|
4
|
+
* Concatenate an array of byte slices into a single slice.
|
5
5
|
*
|
6
|
-
* @
|
6
|
+
* @param buffers Array of byte slices to concatenate.
|
7
|
+
* @returns Hello
|
8
|
+
*
|
9
|
+
* @example Basic usage
|
7
10
|
* ```ts
|
8
11
|
* import { concat } from "@std/bytes/concat";
|
9
12
|
*
|
10
13
|
* const a = new Uint8Array([0, 1, 2]);
|
11
14
|
* const b = new Uint8Array([3, 4, 5]);
|
15
|
+
*
|
12
16
|
* concat([a, b]); // Uint8Array(6) [ 0, 1, 2, 3, 4, 5 ]
|
13
17
|
* ```
|
14
18
|
*/
|
15
|
-
export function concat(
|
19
|
+
export function concat(buffers) {
|
16
20
|
let length = 0;
|
17
|
-
for (const
|
18
|
-
length +=
|
21
|
+
for (const buffer of buffers) {
|
22
|
+
length += buffer.length;
|
19
23
|
}
|
20
24
|
const output = new Uint8Array(length);
|
21
25
|
let index = 0;
|
22
|
-
for (const
|
23
|
-
output.set(
|
24
|
-
index +=
|
26
|
+
for (const buffer of buffers) {
|
27
|
+
output.set(buffer, index);
|
28
|
+
index += buffer.length;
|
25
29
|
}
|
26
30
|
return output;
|
27
31
|
}
|
@@ -0,0 +1,48 @@
|
|
1
|
+
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
2
|
+
// This module is browser compatible.
|
3
|
+
/**
|
4
|
+
* Copy bytes from the source array to the destination array and returns the
|
5
|
+
* number of bytes copied.
|
6
|
+
*
|
7
|
+
* If the source array is larger than what the `dst` array can hold, only the
|
8
|
+
* amount of bytes that fit in the `dst` array are copied.
|
9
|
+
*
|
10
|
+
* @param src Source array to copy from.
|
11
|
+
* @param dst Destination array to copy to.
|
12
|
+
* @param offset Offset in the destination array to start copying to. Defaults
|
13
|
+
* to 0.
|
14
|
+
* @returns Number of bytes copied.
|
15
|
+
*
|
16
|
+
* @example Basic usage
|
17
|
+
* ```ts
|
18
|
+
* import { copy } from "@std/bytes/copy";
|
19
|
+
*
|
20
|
+
* const src = new Uint8Array([9, 8, 7]);
|
21
|
+
* const dst = new Uint8Array([0, 1, 2, 3, 4, 5]);
|
22
|
+
*
|
23
|
+
* copy(src, dst); // 3
|
24
|
+
* dst; // Uint8Array(6) [9, 8, 7, 3, 4, 5]
|
25
|
+
* ```
|
26
|
+
*
|
27
|
+
* @example Copy with offset
|
28
|
+
* ```ts
|
29
|
+
* import { copy } from "@std/bytes/copy";
|
30
|
+
*
|
31
|
+
* const src = new Uint8Array([1, 1, 1, 1]);
|
32
|
+
* const dst = new Uint8Array([0, 0, 0, 0]);
|
33
|
+
*
|
34
|
+
* copy(src, dst, 1); // 3
|
35
|
+
* dst; // Uint8Array(4) [0, 1, 1, 1]
|
36
|
+
* ```
|
37
|
+
* Defining an offset will start copying at the specified index in the
|
38
|
+
* destination array.
|
39
|
+
*/
|
40
|
+
export function copy(src, dst, offset = 0) {
|
41
|
+
offset = Math.max(0, Math.min(offset, dst.byteLength));
|
42
|
+
const dstBytesAvailable = dst.byteLength - offset;
|
43
|
+
if (src.byteLength > dstBytesAvailable) {
|
44
|
+
src = src.subarray(0, dstBytesAvailable);
|
45
|
+
}
|
46
|
+
dst.set(src, offset);
|
47
|
+
return src.byteLength;
|
48
|
+
}
|
@@ -0,0 +1,32 @@
|
|
1
|
+
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
2
|
+
// This module is browser compatible.
|
3
|
+
/**
|
4
|
+
* Returns `true` if the suffix array appears at the end of the source array,
|
5
|
+
* `false` otherwise.
|
6
|
+
*
|
7
|
+
* The complexity of this function is `O(suffix.length)`.
|
8
|
+
*
|
9
|
+
* @param source Source array to check.
|
10
|
+
* @param suffix Suffix array to check for.
|
11
|
+
* @returns `true` if the suffix array appears at the end of the source array,
|
12
|
+
* `false` otherwise.
|
13
|
+
*
|
14
|
+
* @example Basic usage
|
15
|
+
* ```ts
|
16
|
+
* import { endsWith } from "@std/bytes/ends-with";
|
17
|
+
*
|
18
|
+
* const source = new Uint8Array([0, 1, 2, 1, 2, 1, 2, 3]);
|
19
|
+
* const suffix = new Uint8Array([1, 2, 3]);
|
20
|
+
*
|
21
|
+
* endsWith(source, suffix); // true
|
22
|
+
* ```
|
23
|
+
*/
|
24
|
+
export function endsWith(source, suffix) {
|
25
|
+
const diff = source.length - suffix.length;
|
26
|
+
for (let i = suffix.length - 1; i >= 0; i--) {
|
27
|
+
if (source[diff + i] !== suffix[i]) {
|
28
|
+
return false;
|
29
|
+
}
|
30
|
+
}
|
31
|
+
return true;
|
32
|
+
}
|
@@ -0,0 +1,81 @@
|
|
1
|
+
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
2
|
+
// This module is browser compatible.
|
3
|
+
/**
|
4
|
+
* Check whether byte slices are equal to each other using 8-bit comparisons.
|
5
|
+
*
|
6
|
+
* @param a First array to check equality
|
7
|
+
* @param b Second array to check equality
|
8
|
+
* @returns `true` if the arrays are equal, `false` otherwise
|
9
|
+
*
|
10
|
+
* @private
|
11
|
+
*/
|
12
|
+
function equalsNaive(a, b) {
|
13
|
+
for (let i = 0; i < b.length; i++) {
|
14
|
+
if (a[i] !== b[i])
|
15
|
+
return false;
|
16
|
+
}
|
17
|
+
return true;
|
18
|
+
}
|
19
|
+
/** Check whether byte slices are equal to each other using 32-bit comparisons.
|
20
|
+
*
|
21
|
+
* @param a First array to check equality.
|
22
|
+
* @param b Second array to check equality.
|
23
|
+
* @returns `true` if the arrays are equal, `false` otherwise.
|
24
|
+
*
|
25
|
+
* @private
|
26
|
+
*/
|
27
|
+
function equals32Bit(a, b) {
|
28
|
+
const len = a.length;
|
29
|
+
const compactOffset = 3 - ((a.byteOffset + 3) % 4);
|
30
|
+
const compactLen = Math.floor((len - compactOffset) / 4);
|
31
|
+
const compactA = new Uint32Array(a.buffer, a.byteOffset + compactOffset, compactLen);
|
32
|
+
const compactB = new Uint32Array(b.buffer, b.byteOffset + compactOffset, compactLen);
|
33
|
+
for (let i = 0; i < compactOffset; i++) {
|
34
|
+
if (a[i] !== b[i])
|
35
|
+
return false;
|
36
|
+
}
|
37
|
+
for (let i = 0; i < compactA.length; i++) {
|
38
|
+
if (compactA[i] !== compactB[i])
|
39
|
+
return false;
|
40
|
+
}
|
41
|
+
for (let i = compactOffset + compactLen * 4; i < len; i++) {
|
42
|
+
if (a[i] !== b[i])
|
43
|
+
return false;
|
44
|
+
}
|
45
|
+
return true;
|
46
|
+
}
|
47
|
+
/**
|
48
|
+
* Byte length threshold for when to use 32-bit comparisons, based on
|
49
|
+
* benchmarks.
|
50
|
+
*
|
51
|
+
* @see {@link https://github.com/denoland/deno_std/pull/4635}
|
52
|
+
*/
|
53
|
+
const THRESHOLD_32_BIT = 160;
|
54
|
+
/**
|
55
|
+
* Check whether byte slices are equal to each other.
|
56
|
+
*
|
57
|
+
* @param a First array to check equality.
|
58
|
+
* @param b Second array to check equality.
|
59
|
+
* @returns `true` if the arrays are equal, `false` otherwise.
|
60
|
+
*
|
61
|
+
* @example Basic usage
|
62
|
+
* ```ts
|
63
|
+
* import { equals } from "@std/bytes/equals";
|
64
|
+
*
|
65
|
+
* const a = new Uint8Array([1, 2, 3]);
|
66
|
+
* const b = new Uint8Array([1, 2, 3]);
|
67
|
+
* const c = new Uint8Array([4, 5, 6]);
|
68
|
+
*
|
69
|
+
* equals(a, b); // true
|
70
|
+
* equals(b, c); // false
|
71
|
+
* ```
|
72
|
+
*/
|
73
|
+
export function equals(a, b) {
|
74
|
+
if (a.length !== b.length) {
|
75
|
+
return false;
|
76
|
+
}
|
77
|
+
return a.length >= THRESHOLD_32_BIT &&
|
78
|
+
(a.byteOffset % 4) === (b.byteOffset % 4)
|
79
|
+
? equals32Bit(a, b)
|
80
|
+
: equalsNaive(a, b);
|
81
|
+
}
|
@@ -0,0 +1,39 @@
|
|
1
|
+
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
2
|
+
// This module is browser compatible.
|
3
|
+
import { indexOfNeedle } from "./index_of_needle.js";
|
4
|
+
/**
|
5
|
+
* Determines whether the source array contains the needle array.
|
6
|
+
*
|
7
|
+
* The complexity of this function is `O(source.length * needle.length)`.
|
8
|
+
*
|
9
|
+
* @param source Source array to check.
|
10
|
+
* @param needle Needle array to check for.
|
11
|
+
* @param start Start index in the source array to begin the search. Defaults to
|
12
|
+
* 0.
|
13
|
+
* @returns `true` if the source array contains the needle array, `false`
|
14
|
+
* otherwise.
|
15
|
+
*
|
16
|
+
* @example Basic usage
|
17
|
+
* ```ts
|
18
|
+
* import { includesNeedle } from "@std/bytes/includes-needle";
|
19
|
+
*
|
20
|
+
* const source = new Uint8Array([0, 1, 2, 1, 2, 1, 2, 3]);
|
21
|
+
* const needle = new Uint8Array([1, 2]);
|
22
|
+
*
|
23
|
+
* includesNeedle(source, needle); // true
|
24
|
+
* ```
|
25
|
+
*
|
26
|
+
* @example Start index
|
27
|
+
* ```ts
|
28
|
+
* import { includesNeedle } from "@std/bytes/includes-needle";
|
29
|
+
*
|
30
|
+
* const source = new Uint8Array([0, 1, 2, 1, 2, 1, 2, 3]);
|
31
|
+
* const needle = new Uint8Array([1, 2]);
|
32
|
+
*
|
33
|
+
* includesNeedle(source, needle, 6); // false
|
34
|
+
* ```
|
35
|
+
* The search will start at the specified index in the source array.
|
36
|
+
*/
|
37
|
+
export function includesNeedle(source, needle, start = 0) {
|
38
|
+
return indexOfNeedle(source, needle, start) !== -1;
|
39
|
+
}
|
@@ -0,0 +1,66 @@
|
|
1
|
+
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
2
|
+
// This module is browser compatible.
|
3
|
+
/**
|
4
|
+
* Returns the index of the first occurrence of the needle array in the source
|
5
|
+
* array, or -1 if it is not present.
|
6
|
+
*
|
7
|
+
* A start index can be specified as the third argument that begins the search
|
8
|
+
* at that given index. The start index defaults to the start of the array.
|
9
|
+
*
|
10
|
+
* The complexity of this function is `O(source.length * needle.length)`.
|
11
|
+
*
|
12
|
+
* @param source Source array to check.
|
13
|
+
* @param needle Needle array to check for.
|
14
|
+
* @param start Start index in the source array to begin the search. Defaults to
|
15
|
+
* 0.
|
16
|
+
* @returns Index of the first occurrence of the needle array in the source
|
17
|
+
* array, or -1 if it is not present.
|
18
|
+
*
|
19
|
+
* @example Basic usage
|
20
|
+
* ```ts
|
21
|
+
* import { indexOfNeedle } from "@std/bytes/index-of-needle";
|
22
|
+
*
|
23
|
+
* const source = new Uint8Array([0, 1, 2, 1, 2, 1, 2, 3]);
|
24
|
+
* const needle = new Uint8Array([1, 2]);
|
25
|
+
* const notNeedle = new Uint8Array([5, 0]);
|
26
|
+
*
|
27
|
+
* indexOfNeedle(source, needle); // 1
|
28
|
+
* indexOfNeedle(source, notNeedle); // -1
|
29
|
+
* ```
|
30
|
+
*
|
31
|
+
* @example Start index
|
32
|
+
* ```ts
|
33
|
+
* import { indexOfNeedle } from "@std/bytes/index-of-needle";
|
34
|
+
*
|
35
|
+
* const source = new Uint8Array([0, 1, 2, 1, 2, 1, 2, 3]);
|
36
|
+
* const needle = new Uint8Array([1, 2]);
|
37
|
+
*
|
38
|
+
* indexOfNeedle(source, needle, 2); // 3
|
39
|
+
* indexOfNeedle(source, needle, 6); // -1
|
40
|
+
* ```
|
41
|
+
* Defining a start index will begin the search at the specified index in the
|
42
|
+
* source array.
|
43
|
+
*/
|
44
|
+
export function indexOfNeedle(source, needle, start = 0) {
|
45
|
+
if (start >= source.length) {
|
46
|
+
return -1;
|
47
|
+
}
|
48
|
+
if (start < 0) {
|
49
|
+
start = Math.max(0, source.length + start);
|
50
|
+
}
|
51
|
+
const s = needle[0];
|
52
|
+
for (let i = start; i < source.length; i++) {
|
53
|
+
if (source[i] !== s)
|
54
|
+
continue;
|
55
|
+
let matched = 1;
|
56
|
+
let j = i + 1;
|
57
|
+
while (matched < needle.length && source[j] === needle[j - i]) {
|
58
|
+
matched++;
|
59
|
+
j++;
|
60
|
+
}
|
61
|
+
if (matched === needle.length) {
|
62
|
+
return i;
|
63
|
+
}
|
64
|
+
}
|
65
|
+
return -1;
|
66
|
+
}
|
@@ -0,0 +1,63 @@
|
|
1
|
+
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
2
|
+
// This module is browser compatible.
|
3
|
+
/**
|
4
|
+
* Returns the index of the last occurrence of the needle array in the source
|
5
|
+
* array, or -1 if it is not present.
|
6
|
+
*
|
7
|
+
* The complexity of this function is `O(source.length * needle.length)`.
|
8
|
+
*
|
9
|
+
* @param source Source array to check.
|
10
|
+
* @param needle Needle array to check for.
|
11
|
+
* @param start Start index in the source array to begin the search. Defaults to
|
12
|
+
* the end of the array.
|
13
|
+
* @returns Index of the last occurrence of the needle array in the source
|
14
|
+
* array, or -1 if it is not present.
|
15
|
+
*
|
16
|
+
* @example Basic usage
|
17
|
+
* ```ts
|
18
|
+
* import { lastIndexOfNeedle } from "@std/bytes/last-index-of-needle";
|
19
|
+
*
|
20
|
+
* const source = new Uint8Array([0, 1, 2, 1, 2, 1, 2, 3]);
|
21
|
+
* const needle = new Uint8Array([1, 2]);
|
22
|
+
* const notNeedle = new Uint8Array([5, 0]);
|
23
|
+
*
|
24
|
+
* lastIndexOfNeedle(source, needle); // 5
|
25
|
+
* lastIndexOfNeedle(source, notNeedle); // -1
|
26
|
+
* ```
|
27
|
+
*
|
28
|
+
* @example Start index
|
29
|
+
* ```ts
|
30
|
+
* import { lastIndexOfNeedle } from "@std/bytes/last-index-of-needle";
|
31
|
+
*
|
32
|
+
* const source = new Uint8Array([0, 1, 2, 1, 2, 1, 2, 3]);
|
33
|
+
* const needle = new Uint8Array([1, 2]);
|
34
|
+
*
|
35
|
+
* lastIndexOfNeedle(source, needle, 2); // 1
|
36
|
+
* lastIndexOfNeedle(source, needle, 6); // 3
|
37
|
+
* ```
|
38
|
+
* Defining a start index will begin the search at the specified index in the
|
39
|
+
* source array.
|
40
|
+
*/
|
41
|
+
export function lastIndexOfNeedle(source, needle, start = source.length - 1) {
|
42
|
+
if (start < 0) {
|
43
|
+
return -1;
|
44
|
+
}
|
45
|
+
if (start >= source.length) {
|
46
|
+
start = source.length - 1;
|
47
|
+
}
|
48
|
+
const e = needle[needle.length - 1];
|
49
|
+
for (let i = start; i >= 0; i--) {
|
50
|
+
if (source[i] !== e)
|
51
|
+
continue;
|
52
|
+
let matched = 1;
|
53
|
+
let j = i;
|
54
|
+
while (matched < needle.length &&
|
55
|
+
source[--j] === needle[needle.length - 1 - (i - j)]) {
|
56
|
+
matched++;
|
57
|
+
}
|
58
|
+
if (matched === needle.length) {
|
59
|
+
return i - needle.length + 1;
|
60
|
+
}
|
61
|
+
}
|
62
|
+
return -1;
|
63
|
+
}
|
@@ -0,0 +1,151 @@
|
|
1
|
+
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
2
|
+
// This module is browser compatible.
|
3
|
+
/**
|
4
|
+
* Helper functions for working with
|
5
|
+
* {@linkcode https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array | Uint8Array}
|
6
|
+
* byte slices.
|
7
|
+
*
|
8
|
+
* ## Concatenate byte slices
|
9
|
+
*
|
10
|
+
* {@linkcode concat} concatenates an array of byte slices into a single slice.
|
11
|
+
*
|
12
|
+
* ```ts
|
13
|
+
* import { concat } from "@std/bytes/concat";
|
14
|
+
*
|
15
|
+
* const a = new Uint8Array([0, 1, 2]);
|
16
|
+
* const b = new Uint8Array([3, 4, 5]);
|
17
|
+
* concat([a, b]); // Uint8Array(6) [ 0, 1, 2, 3, 4, 5 ]
|
18
|
+
* ```
|
19
|
+
*
|
20
|
+
* ## Copy byte slices
|
21
|
+
*
|
22
|
+
* {@linkcode copy} copies bytes from the `src` array to the `dst` array and
|
23
|
+
* returns the number of bytes copied.
|
24
|
+
*
|
25
|
+
* ```ts
|
26
|
+
* import { copy } from "@std/bytes/copy";
|
27
|
+
*
|
28
|
+
* const src = new Uint8Array([9, 8, 7]);
|
29
|
+
* const dst = new Uint8Array([0, 1, 2, 3, 4, 5]);
|
30
|
+
*
|
31
|
+
* copy(src, dst); // 3
|
32
|
+
* dst; // Uint8Array(6) [9, 8, 7, 3, 4, 5]
|
33
|
+
* ```
|
34
|
+
*
|
35
|
+
* ## Check if a byte slice ends with another byte slice
|
36
|
+
*
|
37
|
+
* {@linkcode endsWith} returns `true` if the suffix array appears at the end of
|
38
|
+
* the source array, `false` otherwise.
|
39
|
+
*
|
40
|
+
* ```ts
|
41
|
+
* import { endsWith } from "@std/bytes/ends-with";
|
42
|
+
*
|
43
|
+
* const source = new Uint8Array([0, 1, 2, 1, 2, 1, 2, 3]);
|
44
|
+
* const suffix = new Uint8Array([1, 2, 3]);
|
45
|
+
*
|
46
|
+
* endsWith(source, suffix); // true
|
47
|
+
* ```
|
48
|
+
*
|
49
|
+
* ## Check if two byte slices are equal
|
50
|
+
*
|
51
|
+
* {@linkcode equals} checks whether byte slices are equal to each other.
|
52
|
+
*
|
53
|
+
* ```ts
|
54
|
+
* import { equals } from "@std/bytes/equals";
|
55
|
+
*
|
56
|
+
* const a = new Uint8Array([1, 2, 3]);
|
57
|
+
* const b = new Uint8Array([1, 2, 3]);
|
58
|
+
* const c = new Uint8Array([4, 5, 6]);
|
59
|
+
*
|
60
|
+
* equals(a, b); // true
|
61
|
+
* equals(b, c); // false
|
62
|
+
* ```
|
63
|
+
*
|
64
|
+
* ## Check if a byte slice includes another byte slice
|
65
|
+
*
|
66
|
+
* {@linkcode includesNeedle} determines whether the source array contains the
|
67
|
+
* needle array.
|
68
|
+
*
|
69
|
+
* ```ts
|
70
|
+
* import { includesNeedle } from "@std/bytes/includes-needle";
|
71
|
+
*
|
72
|
+
* const source = new Uint8Array([0, 1, 2, 1, 2, 1, 2, 3]);
|
73
|
+
* const needle = new Uint8Array([1, 2]);
|
74
|
+
*
|
75
|
+
* includesNeedle(source, needle); // true
|
76
|
+
* ```
|
77
|
+
*
|
78
|
+
* ## Find the index of a byte slice in another byte slice
|
79
|
+
*
|
80
|
+
* {@linkcode indexOfNeedle} returns the index of the first occurrence of the
|
81
|
+
* needle array in the source array, or -1 if it is not present.
|
82
|
+
*
|
83
|
+
* ```ts
|
84
|
+
* import { indexOfNeedle } from "@std/bytes/index-of-needle";
|
85
|
+
*
|
86
|
+
* const source = new Uint8Array([0, 1, 2, 1, 2, 1, 2, 3]);
|
87
|
+
* const needle = new Uint8Array([1, 2]);
|
88
|
+
* const notNeedle = new Uint8Array([5, 0]);
|
89
|
+
*
|
90
|
+
* indexOfNeedle(source, needle); // 1
|
91
|
+
* indexOfNeedle(source, notNeedle); // -1
|
92
|
+
* ```
|
93
|
+
*
|
94
|
+
* ## Find the last index of a byte slice in another byte slice
|
95
|
+
*
|
96
|
+
* {@linkcode lastIndexOfNeedle} returns the index of the last occurrence of the
|
97
|
+
* needle array in the source array, or -1 if it is not present.
|
98
|
+
*
|
99
|
+
* ```ts
|
100
|
+
* import { lastIndexOfNeedle } from "@std/bytes/last-index-of-needle";
|
101
|
+
*
|
102
|
+
* const source = new Uint8Array([0, 1, 2, 1, 2, 1, 2, 3]);
|
103
|
+
* const needle = new Uint8Array([1, 2]);
|
104
|
+
* const notNeedle = new Uint8Array([5, 0]);
|
105
|
+
*
|
106
|
+
* lastIndexOfNeedle(source, needle); // 5
|
107
|
+
* lastIndexOfNeedle(source, notNeedle); // -1
|
108
|
+
* ```
|
109
|
+
*
|
110
|
+
* ## Repeat a byte slice
|
111
|
+
*
|
112
|
+
* {@linkcode repeat} returns a new byte slice composed of `count` repetitions
|
113
|
+
* of the `source` array.
|
114
|
+
*
|
115
|
+
* ```ts
|
116
|
+
* import { repeat } from "@std/bytes/repeat";
|
117
|
+
*
|
118
|
+
* const source = new Uint8Array([0, 1, 2]);
|
119
|
+
*
|
120
|
+
* repeat(source, 3); // Uint8Array(9) [0, 1, 2, 0, 1, 2, 0, 1, 2]
|
121
|
+
*
|
122
|
+
* repeat(source, 0); // Uint8Array(0) []
|
123
|
+
*
|
124
|
+
* repeat(source, -1); // Throws `RangeError`
|
125
|
+
* ```
|
126
|
+
*
|
127
|
+
* ## Check if a byte slice starts with another byte slice
|
128
|
+
*
|
129
|
+
* {@linkcode startsWith} returns `true` if the prefix array appears at the start
|
130
|
+
* of the source array, `false` otherwise.
|
131
|
+
*
|
132
|
+
* ```ts
|
133
|
+
* import { startsWith } from "@std/bytes/starts-with";
|
134
|
+
*
|
135
|
+
* const source = new Uint8Array([0, 1, 2, 1, 2, 1, 2, 3]);
|
136
|
+
* const prefix = new Uint8Array([0, 1, 2]);
|
137
|
+
*
|
138
|
+
* startsWith(source, prefix); // true
|
139
|
+
* ```
|
140
|
+
*
|
141
|
+
* @module
|
142
|
+
*/
|
143
|
+
export * from "./concat.js";
|
144
|
+
export * from "./copy.js";
|
145
|
+
export * from "./ends_with.js";
|
146
|
+
export * from "./equals.js";
|
147
|
+
export * from "./includes_needle.js";
|
148
|
+
export * from "./index_of_needle.js";
|
149
|
+
export * from "./last_index_of_needle.js";
|
150
|
+
export * from "./repeat.js";
|
151
|
+
export * from "./starts_with.js";
|
@@ -0,0 +1,36 @@
|
|
1
|
+
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
2
|
+
// This module is browser compatible.
|
3
|
+
import { copy } from "./copy.js";
|
4
|
+
/**
|
5
|
+
* Returns a new byte slice composed of `count` repetitions of the `source`
|
6
|
+
* array.
|
7
|
+
*
|
8
|
+
* @param source Source array to repeat.
|
9
|
+
* @param count Number of times to repeat the source array.
|
10
|
+
* @returns A new byte slice composed of `count` repetitions of the `source`
|
11
|
+
* array.
|
12
|
+
*
|
13
|
+
* @example Basic usage
|
14
|
+
* ```ts
|
15
|
+
* import { repeat } from "@std/bytes/repeat";
|
16
|
+
*
|
17
|
+
* const source = new Uint8Array([0, 1, 2]);
|
18
|
+
*
|
19
|
+
* repeat(source, 3); // Uint8Array(9) [0, 1, 2, 0, 1, 2, 0, 1, 2]
|
20
|
+
*
|
21
|
+
* repeat(source, 0); // Uint8Array(0) []
|
22
|
+
*
|
23
|
+
* repeat(source, -1); // Throws `RangeError`
|
24
|
+
* ```
|
25
|
+
*/
|
26
|
+
export function repeat(source, count) {
|
27
|
+
if (count < 0 || !Number.isInteger(count)) {
|
28
|
+
throw new RangeError("Count must be a non-negative integer");
|
29
|
+
}
|
30
|
+
const repeated = new Uint8Array(source.length * count);
|
31
|
+
let offset = 0;
|
32
|
+
while (offset < repeated.length) {
|
33
|
+
offset += copy(source, repeated, offset);
|
34
|
+
}
|
35
|
+
return repeated;
|
36
|
+
}
|
@@ -0,0 +1,30 @@
|
|
1
|
+
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
2
|
+
// This module is browser compatible.
|
3
|
+
/**
|
4
|
+
* Returns `true` if the prefix array appears at the start of the source array,
|
5
|
+
* `false` otherwise.
|
6
|
+
*
|
7
|
+
* The complexity of this function is `O(prefix.length)`.
|
8
|
+
*
|
9
|
+
* @param source Source array to check.
|
10
|
+
* @param prefix Prefix array to check for.
|
11
|
+
* @returns `true` if the prefix array appears at the start of the source array,
|
12
|
+
* `false` otherwise.
|
13
|
+
*
|
14
|
+
* @example Basic usage
|
15
|
+
* ```ts
|
16
|
+
* import { startsWith } from "@std/bytes/starts-with";
|
17
|
+
*
|
18
|
+
* const source = new Uint8Array([0, 1, 2, 1, 2, 1, 2, 3]);
|
19
|
+
* const prefix = new Uint8Array([0, 1, 2]);
|
20
|
+
*
|
21
|
+
* startsWith(source, prefix); // true
|
22
|
+
* ```
|
23
|
+
*/
|
24
|
+
export function startsWith(source, prefix) {
|
25
|
+
for (let i = 0; i < prefix.length; i++) {
|
26
|
+
if (source[i] !== prefix[i])
|
27
|
+
return false;
|
28
|
+
}
|
29
|
+
return true;
|
30
|
+
}
|
@@ -7,6 +7,17 @@
|
|
7
7
|
*
|
8
8
|
* This module is browser compatible.
|
9
9
|
*
|
10
|
+
* ```ts
|
11
|
+
* import {
|
12
|
+
* encodeBase64,
|
13
|
+
* decodeBase64,
|
14
|
+
* } from "@std/encoding/base64";
|
15
|
+
*
|
16
|
+
* const encoded = encodeBase64("foobar"); // "Zm9vYmFy"
|
17
|
+
*
|
18
|
+
* decodeBase64(encoded); // Uint8Array(6) [ 102, 111, 111, 98, 97, 114 ]
|
19
|
+
* ```
|
20
|
+
*
|
10
21
|
* @module
|
11
22
|
*/
|
12
23
|
import { validateBinaryLike } from "./_util.js";
|
@@ -81,6 +92,9 @@ const base64abc = [
|
|
81
92
|
*
|
82
93
|
* @see {@link https://datatracker.ietf.org/doc/html/rfc4648#section-4}
|
83
94
|
*
|
95
|
+
* @param data The data to encode.
|
96
|
+
* @returns The base64-encoded string.
|
97
|
+
*
|
84
98
|
* @example
|
85
99
|
* ```ts
|
86
100
|
* import { encodeBase64 } from "@std/encoding/base64";
|
@@ -123,11 +137,14 @@ export function encodeBase64(data) {
|
|
123
137
|
*
|
124
138
|
* @see {@link https://datatracker.ietf.org/doc/html/rfc4648#section-4}
|
125
139
|
*
|
140
|
+
* @param b64 The base64-encoded string to decode.
|
141
|
+
* @returns The decoded data.
|
142
|
+
*
|
126
143
|
* @example
|
127
144
|
* ```ts
|
128
|
-
* import {
|
145
|
+
* import { decodeBase64 } from "@std/encoding/base64";
|
129
146
|
*
|
130
|
-
*
|
147
|
+
* decodeBase64("Zm9vYmFy"); // Uint8Array(6) [ 102, 111, 111, 98, 97, 114 ]
|
131
148
|
* ```
|
132
149
|
*/
|
133
150
|
export function decodeBase64(b64) {
|
@@ -9,20 +9,15 @@
|
|
9
9
|
*
|
10
10
|
* This module is browser compatible.
|
11
11
|
*
|
12
|
-
* @example
|
13
12
|
* ```ts
|
14
13
|
* import {
|
15
14
|
* decodeHex,
|
16
15
|
* encodeHex,
|
17
16
|
* } from "@std/encoding/hex";
|
18
17
|
*
|
19
|
-
* const
|
20
|
-
* const encoded = encodeHex(binary);
|
21
|
-
* console.log(encoded);
|
22
|
-
* // => "616263"
|
18
|
+
* const encoded = encodeHex("abc"); // "616263"
|
23
19
|
*
|
24
|
-
*
|
25
|
-
* // => Uint8Array(3) [ 97, 98, 99 ]
|
20
|
+
* decodeHex(encoded); // Uint8Array(3) [ 97, 98, 99 ]
|
26
21
|
* ```
|
27
22
|
*
|
28
23
|
* @module
|