Skip to content

Commit f706eb7

Browse files
committed
Rename json() into output()
1 parent 8660e1b commit f706eb7

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

phantom-scrape.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,25 @@ var system = require("system");
22
var page = require("webpage").create();
33
var url = system.args[1];
44

5-
function json(o) {
6-
console.log(JSON.stringify(o, null, 2));
5+
/**
6+
* Encode the passed object into JSON and output it to the standard output.
7+
**/
8+
function output(payload) {
9+
console.log(JSON.stringify(payload, null, 2));
710
}
811

912
if (!url) {
10-
json({error: "Missing url"});
13+
output({error: "Missing url"});
1114
phantom.exit();
1215
}
1316

1417
page.open(url, function(status) {
1518
if (status !== "success") {
16-
json({error: "Unable to open " + url});
19+
output({error: "Unable to open " + url});
1720
return phantom.exit();
1821
}
1922
page.injectJs("vendor/Readability.js");
20-
json(page.evaluate(function(url) {
23+
output(page.evaluate(function(url) {
2124
var location = document.location;
2225
var uri = {
2326
spec: location.href,

0 commit comments

Comments
 (0)