diff --git a/.gitignore b/.gitignore index c977c85..15c4d8e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,6 @@ -.DS_Store -*.d.ts -*.log coverage/ node_modules/ +*.d.ts +*.log +.DS_Store yarn.lock diff --git a/index.js b/index.js index b012fe6..2e6b430 100644 --- a/index.js +++ b/index.js @@ -7,7 +7,7 @@ import {collapseWhiteSpace} from 'collapse-white-space' * @typedef {Object.} TrigramDictionary */ -var own = {}.hasOwnProperty +const own = {}.hasOwnProperty /** * Clean `value`. @@ -45,10 +45,10 @@ export function trigrams(value) { * @returns {TrigramDictionary} */ export function asDictionary(value) { - var values = trigrams(value) + const values = trigrams(value) /** @type {TrigramDictionary} */ - var dictionary = {} - var index = -1 + const dictionary = {} + let index = -1 while (++index < values.length) { if (own.call(dictionary, values[index])) { @@ -68,11 +68,11 @@ export function asDictionary(value) { * @returns {TrigramTuples} */ export function asTuples(value) { - var dictionary = asDictionary(value) + const dictionary = asDictionary(value) /** @type {TrigramTuples} */ - var tuples = [] + const tuples = [] /** @type {string} */ - var trigram + let trigram for (trigram in dictionary) { if (own.call(dictionary, trigram)) { @@ -93,8 +93,8 @@ export function asTuples(value) { */ export function tuplesAsDictionary(tuples) { /** @type {TrigramDictionary} */ - var dictionary = {} - var index = -1 + const dictionary = {} + let index = -1 while (++index < tuples.length) { dictionary[tuples[index][0]] = tuples[index][1] diff --git a/package.json b/package.json index b9cff2e..c639cb7 100644 --- a/package.json +++ b/package.json @@ -60,11 +60,7 @@ "trailingComma": "none" }, "xo": { - "prettier": true, - "rules": { - "no-var": "off", - "prefer-arrow-callback": "off" - } + "prettier": true }, "remarkConfig": { "plugins": [ diff --git a/test.js b/test.js index ba310ae..a484c0b 100644 --- a/test.js +++ b/test.js @@ -8,8 +8,8 @@ import { } from './index.js' test('.clean', function (t) { - var ignore = '!"#$%&\'()*+,-./0123456789:;<=>?@' - var index = -1 + const ignore = '!"#$%&\'()*+,-./0123456789:;<=>?@' + let index = -1 t.equal(typeof clean('test'), 'string', 'should return a string') t.equal(clean(), '', 'should accept a missing value')