@hugoalh/adler32 0.5.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # MIT License
2
2
 
3
- Copyright © 2024\~2025 hugoalh
3
+ Copyright © 2024\~2026 HUGOALH
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
6
 
package/README.md CHANGED
@@ -2,54 +2,52 @@
2
2
 
3
3
  [**⚖️** MIT](./LICENSE.md)
4
4
 
5
- [![GitHub: hugoalh/adler32-es](https://img.shields.io/github/v/release/hugoalh/adler32-es?label=hugoalh/adler32-es&labelColor=181717&logo=github&logoColor=ffffff&sort=semver&style=flat "GitHub: hugoalh/adler32-es")](https://github.com/hugoalh/adler32-es)
6
- [![JSR: @hugoalh/adler32](https://img.shields.io/jsr/v/@hugoalh/adler32?label=@hugoalh/adler32&labelColor=F7DF1E&logo=jsr&logoColor=000000&style=flat "JSR: @hugoalh/adler32")](https://jsr.io/@hugoalh/adler32)
7
- [![NPM: @hugoalh/adler32](https://img.shields.io/npm/v/@hugoalh/adler32?label=@hugoalh/adler32&labelColor=CB3837&logo=npm&logoColor=ffffff&style=flat "NPM: @hugoalh/adler32")](https://www.npmjs.com/package/@hugoalh/adler32)
5
+ 🔗
6
+ [DistBoard @hugoalh](https://hugoalh.github.io/distboard/adler32_ecmascript)
7
+ [GitHub](https://github.com/hugoalh/adler32-es)
8
+ ● [JSR](https://jsr.io/@hugoalh/adler32)
9
+ ● [NPM](https://www.npmjs.com/package/@hugoalh/adler32)
8
10
 
9
- An ECMAScript (JavaScript & TypeScript) module to get the checksum of the data with algorithm Adler32.
11
+ An ECMAScript module to get the checksum of the data with algorithm Adler32.
10
12
 
11
- ## 🔰 Begin
13
+ ## 🎯 Runtime Targets
12
14
 
13
- ### 🎯 Targets
15
+ Any runtime which support ECMAScript should able to use this; These runtimes are officially supported:
14
16
 
15
- | **Targets** | **Remote** | **JSR** | **NPM** |
16
- |:--|:-:|:-:|:-:|
17
- | **[Bun](https://bun.sh/)** >= v1.1.0 | ❌ | ✔️ | ✔️ |
18
- | **[Deno](https://deno.land/)** >= v2.1.0 | ✔️ | ✔️ | ✔️ |
19
- | **[NodeJS](https://nodejs.org/)** >= v20.9.0 | ❌ | ✔️ | ✔️ |
17
+ - **[Bun](https://bun.sh/)** >= v1.1.0
18
+ - **[Deno](https://deno.land/)** >= v2.1.0
19
+ - **[NodeJS](https://nodejs.org/)** >= v20.9.0
20
20
 
21
- > [!NOTE]
22
- > - It is possible to use this module in other methods/ways which not listed in here, however those methods/ways are not officially supported, and should beware maybe cause security issues.
21
+ ## 🛡️ Runtime Permissions
22
+
23
+ This does not request any runtime permission.
23
24
 
24
- ### #️⃣ Resources Identifier
25
+ ## #️⃣ Sources & Entrypoints
25
26
 
26
- - **Remote - GitHub Raw:**
27
+ - GitHub Raw
27
28
  ```
28
29
  https://raw.githubusercontent.com/hugoalh/adler32-es/{Tag}/mod.ts
29
30
  ```
30
- - **JSR:**
31
+ - JSR
31
32
  ```
32
- [jsr:]@hugoalh/adler32[@{Tag}]
33
+ jsr:@hugoalh/adler32[@{Tag}]
33
34
  ```
34
- - **NPM:**
35
+ - NPM
35
36
  ```
36
- [npm:]@hugoalh/adler32[@{Tag}]
37
+ npm:@hugoalh/adler32[@{Tag}]
37
38
  ```
38
39
 
39
- > [!NOTE]
40
- > - For usage of remote resources, it is recommended to import the entire module with the main path `mod.ts`, however it is also able to import part of the module with sub path if available, but do not import if:
41
- >
42
- > - it's path has an underscore prefix (e.g.: `_foo.ts`, `_util/bar.ts`), or
43
- > - it is a benchmark or test file (e.g.: `foo.bench.ts`, `foo.test.ts`), or
44
- > - it's symbol has an underscore prefix (e.g.: `_bar`, `_foo`).
45
- >
46
- > These elements are not considered part of the public API, thus no stability is guaranteed for them.
47
- > - For usage of JSR or NPM resources, it is recommended to import the entire module with the main entrypoint, however it is also able to import part of the module with sub entrypoint if available, please visit the [file `jsr.jsonc`](./jsr.jsonc) property `exports` for available sub entrypoints.
48
- > - It is recommended to use this module with tag for immutability.
40
+ | **Name** | **Path** | **Description** |
41
+ |:--|:--|:--|
42
+ | `.` | `./mod.ts` | Default. |
49
43
 
50
- ### 🛡️ Runtime Permissions
51
-
52
- *This module does not request any runtime permission.*
44
+ > [!NOTE]
45
+ > - Different runtimes have vary support for the sources and entrypoints, visit the runtime documentation for more information.
46
+ > - It is recommended to include tag for immutability.
47
+ > - These are not part of the public APIs hence should not be used:
48
+ > - Benchmark/Test file (e.g.: `example.bench.ts`, `example.test.ts`).
49
+ > - Entrypoint name or path include any underscore prefix (e.g.: `_example.ts`, `foo/_example.ts`).
50
+ > - Identifier/Namespace/Symbol include any underscore prefix (e.g.: `_example`, `Foo._example`).
53
51
 
54
52
  ## 🧩 APIs
55
53
 
@@ -75,7 +73,7 @@ An ECMAScript (JavaScript & TypeScript) module to get the checksum of the data w
75
73
 
76
74
  > [!NOTE]
77
75
  > - For the full or prettier documentation, can visit via:
78
- > - [Deno CLI `deno doc`](https://docs.deno.com/runtime/reference/cli/documentation_generator/)
76
+ > - [Deno CLI `deno doc`](https://docs.deno.com/runtime/reference/cli/doc/)
79
77
  > - [JSR](https://jsr.io/@hugoalh/adler32)
80
78
 
81
79
  ## ✍️ Examples
package/mod.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["src/mod.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,qBAAqB,GAC9B,MAAM,GACN,cAAc,GACd,UAAU,GACV,WAAW,GACX,WAAW,CAAC;AACf;;GAEG;AACH,qBAAa,OAAO;;IACnB,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,MAAM,CAEjC;IAMD;;;OAGG;gBACS,IAAI,CAAC,EAAE,qBAAqB;IAKxC;;;OAGG;IACH,IAAI,OAAO,IAAI,OAAO,CAErB;IACD;;;OAGG;IACH,MAAM,IAAI,IAAI;IAId;;;OAGG;IACH,IAAI,IAAI,UAAU;IAalB;;;OAGG;IACH,OAAO,IAAI,MAAM;IASjB;;;;OAIG;IACH,MAAM,CAAC,IAAI,EAAE,qBAAqB,GAAG,IAAI;IAazC;;;;OAIG;IACG,gBAAgB,CAAC,MAAM,EAAE,cAAc,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;CAMpF;AACD,eAAe,OAAO,CAAC"}
1
+ {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["src/mod.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,qBAAqB,GAC9B,MAAM,GACN,cAAc,GACd,UAAU,GACV,WAAW,GACX,WAAW,CAAC;AACf;;GAEG;AACH,qBAAa,OAAO;;IACnB,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,MAAM,CAEjC;IAMD;;;OAGG;gBACS,IAAI,CAAC,EAAE,qBAAqB;IAKxC;;;OAGG;IACH,IAAI,OAAO,IAAI,OAAO,CAErB;IACD;;;OAGG;IACH,MAAM,IAAI,IAAI;IAId;;;OAGG;IACH,IAAI,IAAI,UAAU;IAIlB;;;OAGG;IACH,OAAO,IAAI,MAAM;IASjB;;;;OAIG;IACH,MAAM,CAAC,IAAI,EAAE,qBAAqB,GAAG,IAAI;IAazC;;;;OAIG;IACG,gBAAgB,CAAC,MAAM,EAAE,cAAc,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;CAMpF;AACD,eAAe,OAAO,CAAC"}
package/mod.js CHANGED
@@ -1,3 +1,7 @@
1
+ if (typeof Uint8Array.fromHex === "undefined") {
2
+ //deno-lint-ignore hugoalh/no-import-dynamic -- Polyfill.
3
+ await import("es-arraybuffer-base64/Uint8Array.fromHex/auto");
4
+ }
1
5
  /**
2
6
  * Get the checksum of the data with algorithm Adler32.
3
7
  */
@@ -39,16 +43,7 @@ export class Adler32 {
39
43
  * @returns {Uint8Array}
40
44
  */
41
45
  hash() {
42
- if (this.#hashUint8Array === null) {
43
- const hex = this.hashHex();
44
- const bytes = [];
45
- for (let index = 0; index < hex.length; index += 2) {
46
- bytes.push(hex.slice(index, index + 2));
47
- }
48
- this.#hashUint8Array = Uint8Array.from(bytes.map((byte) => {
49
- return Number.parseInt(byte, 16);
50
- }));
51
- }
46
+ this.#hashUint8Array ??= Uint8Array.fromHex(this.hashHex());
52
47
  return Uint8Array.from(this.#hashUint8Array);
53
48
  }
54
49
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hugoalh/adler32",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "A module to get the checksum of the data with algorithm Adler32.",
5
5
  "keywords": [
6
6
  "adler32",
@@ -28,11 +28,12 @@
28
28
  "type": "git",
29
29
  "url": "git+https://github.com/hugoalh/adler32-es.git"
30
30
  },
31
- "scripts": {},
31
+ "dependencies": {
32
+ "es-arraybuffer-base64": "^1.1.2"
33
+ },
32
34
  "devDependencies": {
33
- "@types/node": "^20.9.0"
35
+ "@types/node": "^24.5.0"
34
36
  },
35
- "engines": {},
36
37
  "private": false,
37
38
  "publishConfig": {
38
39
  "access": "public"