Skip to content

v7.0.0

Compare
Choose a tag to compare
@Richienb Richienb released this 03 Apr 14:25
· 13 commits to master since this release
8dd46b7

Breaking

  • Callback support has been removed in favour of promises.

Replacement:

- ipLocation("172.217.167.78", [], (error, result) => {...})
+ ipLocation("172.217.167.78").then((result) => {...}).catch((error) => {...})
  • Support for the provider array was removed.

Replacement: See the previous diff.

  • The resolved object is now differently constructed.

Difference:

{
-	city: "Mountain View",
-	country: "US",
-	countryCode: "US",
-	ip: "172.217.167.78",
	latitude: 37.4056,
	longitude: -122.0775,
-	postal: "94043",
-	region: "California",
-	regionCode: "",
-	timezone: "America/Los_Angeles"
+	region: {
+		name: "New South Wales",
+		code: "NSW"
+	},
+	country: {
+		name: "Australia",
+		code: "AU",
+		iso3: "AUS",
+		capital: "Canberra",
+		tld: ".au",
+		population: 21515754,
+		area: 7686850,
+		callingCode: "+61",
+		postalCode: "2000",
+		timezone: {
+			code: "Australia/Sydney",
+			offset: "+1100"
+		},
+		currency: {
+			name: "Dollar",
+			code: "AUD"
+		},
+		languages: ["en-AU"]
+	},
+	continent: {
+		code: "OC",
+		inEu: false
+	}
}
  • TypeError is now thrown instead of InvalidIPError.
  • ky.HTTPError and ky.TimeoutError is now thrown instead of ProviderError.
  • Support for debug has been removed.
  • Node.js 10 or later is now required.

Enhancements

  • Allow importing normally in CommonJS.
  • Modern browsers are now supported. You can optionally use a bundler to support older ones.

Fixes

  • Stopped trying to contact an API that started requiring API keys. This leaves only one API, allowing the results to stay consistent between runs.
  • The request package was removed, stopping the deprecation message.