loader-utils
Advanced tools
Comparing version 3.2.2 to 3.3.0
@@ -123,10 +123,15 @@ "use strict"; | ||
digestType === "base58" || | ||
digestType === "base62" | ||
digestType === "base62" || | ||
digestType === "base64safe" | ||
) { | ||
return encodeBufferToBase(hash.digest(), digestType.substr(4), maxLength); | ||
} else { | ||
return hash.digest(digestType || "hex").substr(0, maxLength); | ||
return encodeBufferToBase( | ||
hash.digest(), | ||
digestType === "base64safe" ? 64 : digestType.substr(4), | ||
maxLength | ||
); | ||
} | ||
return hash.digest(digestType || "hex").substr(0, maxLength); | ||
} | ||
module.exports = getHashDigest; |
{ | ||
"name": "loader-utils", | ||
"version": "3.2.2", | ||
"version": "3.3.0", | ||
"author": "Tobias Koppers @sokra", | ||
@@ -5,0 +5,0 @@ "description": "utils for webpack loaders", |
@@ -79,3 +79,3 @@ # loader-utils | ||
- other `hashType`s, i. e. `xxhash64`, `sha1`, `md4` (wasm version), `native-md4` (`crypto` module version), `md5`, `sha256`, `sha512` | ||
- other `digestType`s, i. e. `hex`, `base26`, `base32`, `base36`, `base49`, `base52`, `base58`, `base62`, `base64` | ||
- other `digestType`s, i. e. `hex`, `base26`, `base32`, `base36`, `base49`, `base52`, `base58`, `base62`, `base64`, `base64safe` | ||
- and `length` the length in chars | ||
@@ -85,3 +85,3 @@ - `[hash]` the hash of `options.content` (Buffer) (by default it's the hex digest of the `xxhash64` hash) | ||
- other `hashType`s, i. e. `xxhash64`, `sha1`, `md4` (wasm version), `native-md4` (`crypto` module version), `md5`, `sha256`, `sha512` | ||
- other `digestType`s, i. e. `hex`, `base26`, `base32`, `base36`, `base49`, `base52`, `base58`, `base62`, `base64` | ||
- other `digestType`s, i. e. `hex`, `base26`, `base32`, `base36`, `base49`, `base52`, `base58`, `base62`, `base64`, `base64safe` | ||
- and `length` the length in chars | ||
@@ -92,2 +92,4 @@ - `[N]` the N-th match obtained from matching the current file name against `options.regExp` | ||
`digestType` with `base64safe` don't contain `/`, `+` and `=` symbols. | ||
Examples | ||
@@ -163,3 +165,3 @@ | ||
- `hashType` one of `xxhash64`, `sha1`, `md4`, `md5`, `sha256`, `sha512` or any other node.js supported hash type | ||
- `digestType` one of `hex`, `base26`, `base32`, `base36`, `base49`, `base52`, `base58`, `base62`, `base64` | ||
- `digestType` one of `hex`, `base26`, `base32`, `base36`, `base49`, `base52`, `base58`, `base62`, `base64`, `base64safe` | ||
- `maxLength` the maximum length in chars | ||
@@ -166,0 +168,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
32137
640
168