From aca9137c03ee41acbc3f7ae9a85ce51c5cbca618 Mon Sep 17 00:00:00 2001 From: Robert Kowalski Date: Thu, 8 Jun 2017 14:34:14 +0200 Subject: [PATCH] docs: fix example - assign the result to a variable (`res`) - format as JS - use ES6 --- README.markdown | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/README.markdown b/README.markdown index 819e7de..80e9256 100644 --- a/README.markdown +++ b/README.markdown @@ -32,13 +32,15 @@ Node GeoIP Native provides methods for: ## Examples - var geoip = require("geoip-native"); - var ip = "123.123.123.123"; - geoip.lookup(ip); - console.log("country: " + ip.name + " / " + ip.code); - - // in practice you'd want: - // ip = request.headers["x-forwarded-for"] || request.connection.remoteAddress, +```js +const geoip = require("geoip-native"); +const ip = "123.123.123.123"; +const res = geoip.lookup(ip); +console.log("country: " + res.name + " / " + res.code); + +// in practice you'd want: +// ip = request.headers["x-forwarded-for"] || request.connection.remoteAddress, +``` ### What's missing Be neat to expand this to include cities.