diff --git a/.editorconfig b/.editorconfig
index 98a761d..1c6314a 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -7,6 +7,6 @@ charset = utf-8
 trim_trailing_whitespace = true
 insert_final_newline = true
 
-[{package.json,*.yml}]
+[*.yml]
 indent_style = space
 indent_size = 2
diff --git a/.gitattributes b/.gitattributes
index 391f0a4..6313b56 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -1,2 +1 @@
-* text=auto
-*.js text eol=lf
+* text=auto eol=lf
diff --git a/.gitignore b/.gitignore
index 3c3629e..239ecff 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,2 @@
 node_modules
+yarn.lock
diff --git a/.npmrc b/.npmrc
new file mode 100644
index 0000000..43c97e7
--- /dev/null
+++ b/.npmrc
@@ -0,0 +1 @@
+package-lock=false
diff --git a/.travis.yml b/.travis.yml
index 2c6e9b0..2ae9d62 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,7 +1,5 @@
-sudo: false
 language: node_js
 node_js:
+  - '10'
+  - '8'
   - '6'
-  - '4'
-  - '0.12'
-  - '0.10'
diff --git a/bench.js b/bench.js
index 8309236..c623c3e 100644
--- a/bench.js
+++ b/bench.js
@@ -1,14 +1,14 @@
 /* globals bench suite */
 'use strict';
-var levenshteinEditDistance = require('levenshtein-edit-distance');
-var fastLevenshtein = require('fast-levenshtein').get;
-var levenshteinComponent = require('levenshtein-component');
-var ld = require('ld').computeDistance;
-var levdist = require('levdist');
-var natural = require('natural').LevenshteinDistance;
-var levenshtein = require('levenshtein');
-var talisman = require('talisman/metrics/distance/levenshtein');
-var leven = require('./');
+const levenshteinEditDistance = require('levenshtein-edit-distance');
+const fastLevenshtein = require('fast-levenshtein').get;
+const levenshteinComponent = require('levenshtein-component');
+const ld = require('ld').computeDistance;
+const levdist = require('levdist');
+const natural = require('natural').LevenshteinDistance;
+const levenshtein = require('levenshtein');
+const talisman = require('talisman/metrics/distance/levenshtein');
+const leven = require('.');
 
 function run(fn) {
 	fn('a', 'b');
@@ -25,42 +25,43 @@ function run(fn) {
 	fn('levenshtein', 'frankenstein');
 	fn('distance', 'difference');
 	fn('因為我是中國人所以我會說中文', '因為我是英國人所以我會說英文');
+	fn('Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim.', 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim.');
 }
 
-suite('leven', function () {
-	bench('leven', function () {
+suite('leven', () => {
+	bench('leven', () => {
 		run(leven);
 	});
 
-	bench('talisman', function () {
+	bench('talisman', () => {
 		run(talisman);
 	});
 
-	bench('levenshtein-edit-distance', function () {
+	bench('levenshtein-edit-distance', () => {
 		run(levenshteinEditDistance);
 	});
 
-	bench('fast-levenshtein', function () {
+	bench('fast-levenshtein', () => {
 		run(fastLevenshtein);
 	});
 
-	bench('levenshtein-component', function () {
+	bench('levenshtein-component', () => {
 		run(levenshteinComponent);
 	});
 
-	bench('levdist', function () {
-		run(levdist);
+	bench('ld', () => {
+		run(ld);
 	});
 
-	bench('ld', function () {
-		run(ld);
+	bench('levenshtein', () => {
+		run(levenshtein);
 	});
 
-	bench('natural', function () {
-		run(natural);
+	bench('levdist', () => {
+		run(levdist);
 	});
 
-	bench('levenshtein', function () {
-		run(levenshtein);
+	bench('natural', () => {
+		run(natural);
 	});
 });
diff --git a/debian/changelog b/debian/changelog
index ce8e4d7..60d99ff 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+node-leven (3.1.0-1) UNRELEASED; urgency=medium
+
+  * New upstream release.
+
+ -- Debian Janitor <janitor@jelmer.uk>  Thu, 27 Jun 2019 05:38:09 +0000
+
 node-leven (2.1.0-2) unstable; urgency=low
 
   * Enhance tests for autopkgtest.
diff --git a/index.d.ts b/index.d.ts
new file mode 100644
index 0000000..571833a
--- /dev/null
+++ b/index.d.ts
@@ -0,0 +1,21 @@
+declare const leven: {
+	/**
+	Measure the difference between two strings.
+
+	@example
+	```
+	import leven = require('leven');
+
+	leven('cat', 'cow');
+	//=> 2
+	```
+	*/
+	(left: string, right: string): number;
+
+	// TODO: Remove this for the next major release, refactor the whole definition to:
+	// declare function leven(left: string, right: string): number;
+	// export = leven;
+	default: typeof leven;
+};
+
+export = leven;
diff --git a/index.js b/index.js
index bb44b79..25f5a3d 100644
--- a/index.js
+++ b/index.js
@@ -1,85 +1,77 @@
-/* eslint-disable no-nested-ternary */
 'use strict';
-var arr = [];
-var charCodeCache = [];
+const array = [];
+const charCodeCache = [];
 
-module.exports = function (a, b) {
-	if (a === b) {
+const leven = (left, right) => {
+	if (left === right) {
 		return 0;
 	}
 
-	var swap = a;
+	const swap = left;
 
 	// Swapping the strings if `a` is longer than `b` so we know which one is the
 	// shortest & which one is the longest
-	if (a.length > b.length) {
-		a = b;
-		b = swap;
+	if (left.length > right.length) {
+		left = right;
+		right = swap;
 	}
 
-	var aLen = a.length;
-	var bLen = b.length;
-
-	if (aLen === 0) {
-		return bLen;
-	}
-
-	if (bLen === 0) {
-		return aLen;
-	}
+	let leftLength = left.length;
+	let rightLength = right.length;
 
 	// Performing suffix trimming:
 	// We can linearly drop suffix common to both strings since they
 	// don't increase distance at all
 	// Note: `~-` is the bitwise way to perform a `- 1` operation
-	while (aLen > 0 && (a.charCodeAt(~-aLen) === b.charCodeAt(~-bLen))) {
-		aLen--;
-		bLen--;
-	}
-
-	if (aLen === 0) {
-		return bLen;
+	while (leftLength > 0 && (left.charCodeAt(~-leftLength) === right.charCodeAt(~-rightLength))) {
+		leftLength--;
+		rightLength--;
 	}
 
 	// Performing prefix trimming
 	// We can linearly drop prefix common to both strings since they
 	// don't increase distance at all
-	var start = 0;
+	let start = 0;
 
-	while (start < aLen && (a.charCodeAt(start) === b.charCodeAt(start))) {
+	while (start < leftLength && (left.charCodeAt(start) === right.charCodeAt(start))) {
 		start++;
 	}
 
-	aLen -= start;
-	bLen -= start;
+	leftLength -= start;
+	rightLength -= start;
 
-	if (aLen === 0) {
-		return bLen;
+	if (leftLength === 0) {
+		return rightLength;
 	}
 
-	var bCharCode;
-	var ret;
-	var tmp;
-	var tmp2;
-	var i = 0;
-	var j = 0;
+	let bCharCode;
+	let result;
+	let temp;
+	let temp2;
+	let i = 0;
+	let j = 0;
 
-	while (i < aLen) {
-		charCodeCache[start + i] = a.charCodeAt(start + i);
-		arr[i] = ++i;
+	while (i < leftLength) {
+		charCodeCache[i] = left.charCodeAt(start + i);
+		array[i] = ++i;
 	}
 
-	while (j < bLen) {
-		bCharCode = b.charCodeAt(start + j);
-		tmp = j++;
-		ret = j;
+	while (j < rightLength) {
+		bCharCode = right.charCodeAt(start + j);
+		temp = j++;
+		result = j;
 
-		for (i = 0; i < aLen; i++) {
-			tmp2 = bCharCode === charCodeCache[start + i] ? tmp : tmp + 1;
-			tmp = arr[i];
-			ret = arr[i] = tmp > ret ? tmp2 > ret ? ret + 1 : tmp2 : tmp2 > tmp ? tmp + 1 : tmp2;
+		for (i = 0; i < leftLength; i++) {
+			temp2 = bCharCode === charCodeCache[i] ? temp : temp + 1;
+			temp = array[i];
+			// eslint-disable-next-line no-multi-assign
+			result = array[i] = temp > result ? temp2 > result ? result + 1 : temp2 : temp2 > temp ? temp + 1 : temp2;
 		}
 	}
 
-	return ret;
+	return result;
 };
+
+module.exports = leven;
+// TODO: Remove this for the next major release
+module.exports.default = leven;
diff --git a/index.test-d.ts b/index.test-d.ts
new file mode 100644
index 0000000..79b7ca2
--- /dev/null
+++ b/index.test-d.ts
@@ -0,0 +1,4 @@
+import {expectType} from 'tsd';
+import leven = require('.');
+
+expectType<number>(leven('kitten', 'sitting'));
diff --git a/license b/license
index 654d0bf..e7af2f7 100644
--- a/license
+++ b/license
@@ -1,21 +1,9 @@
-The MIT License (MIT)
+MIT License
 
 Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
 
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
 
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
 
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/package.json b/package.json
index 4fd64bb..e1b3d8e 100644
--- a/package.json
+++ b/package.json
@@ -1,55 +1,57 @@
 {
-  "name": "leven",
-  "version": "2.1.0",
-  "description": "Measure the difference between two strings using the fastest JS implementation of the Levenshtein distance algorithm",
-  "license": "MIT",
-  "repository": "sindresorhus/leven",
-  "author": {
-    "name": "Sindre Sorhus",
-    "email": "sindresorhus@gmail.com",
-    "url": "sindresorhus.com"
-  },
-  "engines": {
-    "node": ">=0.10.0"
-  },
-  "scripts": {
-    "test": "xo && ava",
-    "bench": "matcha bench.js"
-  },
-  "files": [
-    "index.js"
-  ],
-  "keywords": [
-    "leven",
-    "levenshtein",
-    "distance",
-    "algorithm",
-    "algo",
-    "string",
-    "difference",
-    "diff",
-    "fast",
-    "fuzzy",
-    "similar",
-    "similarity",
-    "compare",
-    "comparison",
-    "edit",
-    "text",
-    "match",
-    "matching"
-  ],
-  "devDependencies": {
-    "ava": "^0.17.0",
-    "fast-levenshtein": "^2.0.5",
-    "ld": "^0.1.0",
-    "levdist": "^2.0.0",
-    "levenshtein": "^1.0.4",
-    "levenshtein-component": "0.0.1",
-    "levenshtein-edit-distance": "^2.0.0",
-    "matcha": "^0.7.0",
-    "natural": "^0.4.0",
-    "talisman": "^0.18.0",
-    "xo": "^0.16.0"
-  }
+	"name": "leven",
+	"version": "3.1.0",
+	"description": "Measure the difference between two strings using the fastest JS implementation of the Levenshtein distance algorithm",
+	"license": "MIT",
+	"repository": "sindresorhus/leven",
+	"author": {
+		"name": "Sindre Sorhus",
+		"email": "sindresorhus@gmail.com",
+		"url": "sindresorhus.com"
+	},
+	"engines": {
+		"node": ">=6"
+	},
+	"scripts": {
+		"test": "xo && ava && tsd",
+		"bench": "matcha bench.js"
+	},
+	"files": [
+		"index.js",
+		"index.d.ts"
+	],
+	"keywords": [
+		"leven",
+		"levenshtein",
+		"distance",
+		"algorithm",
+		"algo",
+		"string",
+		"difference",
+		"diff",
+		"fast",
+		"fuzzy",
+		"similar",
+		"similarity",
+		"compare",
+		"comparison",
+		"edit",
+		"text",
+		"match",
+		"matching"
+	],
+	"devDependencies": {
+		"ava": "^1.4.1",
+		"fast-levenshtein": "^2.0.6",
+		"ld": "^0.1.0",
+		"levdist": "^2.2.9",
+		"levenshtein": "^1.0.5",
+		"levenshtein-component": "^0.0.1",
+		"levenshtein-edit-distance": "^2.0.3",
+		"matcha": "^0.7.0",
+		"natural": "^0.6.3",
+		"talisman": "^0.21.0",
+		"tsd": "^0.7.2",
+		"xo": "^0.24.0"
+	}
 }
diff --git a/readme.md b/readme.md
index 9493c9f..33625c4 100644
--- a/readme.md
+++ b/readme.md
@@ -1,13 +1,13 @@
 # leven [![Build Status](https://travis-ci.org/sindresorhus/leven.svg?branch=master)](https://travis-ci.org/sindresorhus/leven)
 
 > Measure the difference between two strings<br>
-> The fastest JS implementation of the [Levenshtein distance](http://en.wikipedia.org/wiki/Levenshtein_distance) algorithm
+> One of the fastest JS implementations of the [Levenshtein distance](https://en.wikipedia.org/wiki/Levenshtein_distance) algorithm
 
 
 ## Install
 
 ```
-$ npm install --save leven
+$ npm install leven
 ```
 
 
@@ -28,15 +28,15 @@ $ npm run bench
 ```
 
 ```
-         401,487 op/s » leven
-         371,707 op/s » talisman
-         264,191 op/s » levenshtein-edit-distance
-         152,923 op/s » fast-levenshtein
-          57,267 op/s » levenshtein-component
-          19,915 op/s » levdist
-          21,802 op/s » ld
-          18,079 op/s » natural
-          11,761 op/s » levenshtein
+         165,926 op/s » leven
+         164,398 op/s » talisman
+           1,044 op/s » levenshtein-edit-distance
+             628 op/s » fast-levenshtein
+             497 op/s » levenshtein-component
+             195 op/s » ld
+             190 op/s » levenshtein
+             168 op/s » levdist
+              10 op/s » natural
 ```
 
 
diff --git a/test.js b/test.js
index d3d03a4..d35b1b5 100644
--- a/test.js
+++ b/test.js
@@ -1,19 +1,19 @@
 import test from 'ava';
-import m from './';
+import leven from '.';
 
-test(t => {
-	t.is(m('a', 'b'), 1);
-	t.is(m('ab', 'ac'), 1);
-	t.is(m('ac', 'bc'), 1);
-	t.is(m('abc', 'axc'), 1);
-	t.is(m('kitten', 'sitting'), 3);
-	t.is(m('xabxcdxxefxgx', '1ab2cd34ef5g6'), 6);
-	t.is(m('cat', 'cow'), 2);
-	t.is(m('xabxcdxxefxgx', 'abcdefg'), 6);
-	t.is(m('javawasneat', 'scalaisgreat'), 7);
-	t.is(m('example', 'samples'), 3);
-	t.is(m('sturgeon', 'urgently'), 6);
-	t.is(m('levenshtein', 'frankenstein'), 6);
-	t.is(m('distance', 'difference'), 5);
-	t.is(m('因為我是中國人所以我會說中文', '因為我是英國人所以我會說英文'), 2);
+test('main', t => {
+	t.is(leven('a', 'b'), 1);
+	t.is(leven('ab', 'ac'), 1);
+	t.is(leven('ac', 'bc'), 1);
+	t.is(leven('abc', 'axc'), 1);
+	t.is(leven('kitten', 'sitting'), 3);
+	t.is(leven('xabxcdxxefxgx', '1ab2cd34ef5g6'), 6);
+	t.is(leven('cat', 'cow'), 2);
+	t.is(leven('xabxcdxxefxgx', 'abcdefg'), 6);
+	t.is(leven('javawasneat', 'scalaisgreat'), 7);
+	t.is(leven('example', 'samples'), 3);
+	t.is(leven('sturgeon', 'urgently'), 6);
+	t.is(leven('levenshtein', 'frankenstein'), 6);
+	t.is(leven('distance', 'difference'), 5);
+	t.is(leven('因為我是中國人所以我會說中文', '因為我是英國人所以我會說英文'), 2);
 });