imagic-utils 2.1.0 → 2.1.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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "imagic-utils",
3
- "version": "2.1.0",
4
- "description": "Utility helpers for Node.js and browsers",
3
+ "version": "2.1.1",
4
+ "description": "Provide random, hashing, array, string, and OS utility helpers for Node.js and browsers",
5
5
  "exports": {
6
6
  ".": {
7
7
  "browser": "./src/browser.js",
@@ -12,7 +12,11 @@
12
12
  "./package.json": "./package.json"
13
13
  },
14
14
  "sideEffects": false,
15
- "files": ["src", "README.md", "LICENSE"],
15
+ "files": [
16
+ "src",
17
+ "README.md",
18
+ "LICENSE"
19
+ ],
16
20
  "type": "module",
17
21
  "scripts": {
18
22
  "test": "node --test ./tests/**/*.test.js",
@@ -25,7 +29,10 @@
25
29
  "type": "git",
26
30
  "url": "git+https://github.com/iMagicKey/utils.git"
27
31
  },
28
- "keywords": ["utils", "util"],
32
+ "keywords": [
33
+ "utils",
34
+ "util"
35
+ ],
29
36
  "author": "iMagicKey",
30
37
  "license": "MIT",
31
38
  "bugs": {
@@ -105,7 +105,7 @@ function toUtf8(value) {
105
105
 
106
106
  export default function md5(data) {
107
107
  let str
108
- if (Buffer.isBuffer(data) || data instanceof Uint8Array) {
108
+ if ((typeof Buffer !== 'undefined' && Buffer.isBuffer(data)) || data instanceof Uint8Array) {
109
109
  str = Array.from(data, (b) => String.fromCharCode(b)).join('')
110
110
  } else {
111
111
  str = toUtf8(String(data))