Skip to content

Commit eef0119

Browse files
committed
Support node 7
1 parent c1f2180 commit eef0119

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

examples/node/pagination_js_commonjs/example.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,27 +16,27 @@ const run = async () => {
1616
let page1 = await getJson("google", params);
1717
console.log(
1818
"First page links",
19-
extractLinks(page1.organic_results),
19+
extractLinks(page1.organic_results)
2020
);
2121
if (page1.next) {
2222
let page2 = await page1.next();
2323
console.log(
2424
"Second page links",
25-
extractLinks(page2.organic_results),
25+
extractLinks(page2.organic_results)
2626
);
2727
}
2828

2929
// Pagination (callback)
3030
getJson("google", params, (page1) => {
3131
console.log(
3232
"First page links",
33-
extractLinks(page1.organic_results),
33+
extractLinks(page1.organic_results)
3434
);
3535
if (page1.next) {
3636
page1.next((page2) => {
3737
console.log(
3838
"Second page links",
39-
extractLinks(page2.organic_results),
39+
extractLinks(page2.organic_results)
4040
);
4141
});
4242
}
@@ -49,7 +49,7 @@ const run = async () => {
4949
page2 = await page1.next();
5050
console.log(
5151
"Second page links",
52-
extractLinks(page2.organic_results),
52+
extractLinks(page2.organic_results)
5353
);
5454
}
5555

scripts/build_npm.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ await emptyDir("./npm");
55

66
await build({
77
test: false, // Turned off to avoid publishing tests
8+
typeCheck: false,
89
entryPoints: ["./mod.ts"],
910
rootTestDir: "./tests",
1011
outDir: "./npm",
@@ -20,8 +21,8 @@ await build({
2021
},
2122
compilerOptions: {
2223
// https://github.com/microsoft/TypeScript/wiki/Node-Target-Mapping
23-
lib: ["es2018"],
24-
target: "ES2018",
24+
lib: ["es2017"],
25+
target: "ES2017",
2526
},
2627
package: {
2728
name: "serpapi",

src/utils.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import type { EngineName, EngineParameters } from "./types.ts";
22
import { version } from "../version.ts";
33
import fetch from "npm:cross-fetch@3.1.4";
4+
import core from "npm:core-js-pure@3.28.0";
5+
const { globalThis, URL, URLSearchParams } = core;
46

57
type UrlParameters = Record<
68
string,

0 commit comments

Comments
 (0)