Skip to content

Commit 37112ac

Browse files
committed
nodejs < 11 support
1 parent 7905a85 commit 37112ac

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

index.d.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
export function canonicalize(url: string): string;
22
export function suffixPostfixExpressions(url: string): Set<string>;
3-
export function truncatedSha256Prefix(url: string, size: number): Buffer<Uint8Array>;
4-
export function getPrefixes(url: string, size: number = 32*8): Set<Buffer<Uint8Array>>;
3+
export function truncatedSha256Prefix(url: string, size: number): Buffer;
4+
export function getPrefixes(url: string, size?: number): Set<Buffer>;

index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ exports.suffixPostfixExpressions = function (canonicalURL) {
179179
iDomain = iDomain.replace(/^.*?\./, '')
180180
}
181181
res.splice(1, res.length - 5);
182-
return new Set(res.flat());
182+
return new Set([].concat(...res));
183183
}
184184

185185
exports.truncatedSha256Prefix = (str, bits) => {

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "webrisk-hash",
3-
"version": "1.2.3",
3+
"version": "1.2.5",
44
"description": "",
55
"main": "index.js",
66
"typings": "index.d.ts",

test/getPrefixes.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const { getPrefixes } = require("../index");
33

44
exports.simple = function() {
55
assert.deepEqual(
6-
getPrefixes("https://google.com/a/test/index.html?abc123"),
6+
getPrefixes("https://google.com/a/test/index.html?abc123", 32),
77
new Set([
88
Buffer.from([136, 152, 30, 98]),
99
Buffer.from([166, 49, 51, 141]),

0 commit comments

Comments
 (0)