From a486d1ac411796c2122c680babfb29abda4953fd Mon Sep 17 00:00:00 2001 From: Tnarita0000 Date: Sat, 3 Nov 2018 23:00:13 -0700 Subject: [PATCH] Remove var in Libraries/emitter/* (#22087) Summary: Replaces the keywords var with const in Libraries/emitter/EventValidator.js If this PR fixes an issue, type "Fixes #issueNumber" to automatically close the issue when the PR is merged. _Pull requests that expand test coverage are more likely to get reviewed. Add a test case whenever possible!_ - [x] Check npm run flow - [x] Check npm run flow-check-ios - [x] Check npm run flow-check-android [GENERAL] [ENHANCEMENT] [Libraries/emitter] - remove `var` Pull Request resolved: https://github.com/facebook/react-native/pull/22087 Differential Revision: D12918444 Pulled By: TheSavior fbshipit-source-id: 630ccb283fd6c3118a22124a656038eac4a88599 --- Libraries/vendor/emitter/EventValidator.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Libraries/vendor/emitter/EventValidator.js b/Libraries/vendor/emitter/EventValidator.js index f0dc3c58adf7bb..39bf3147bdfa48 100644 --- a/Libraries/vendor/emitter/EventValidator.js +++ b/Libraries/vendor/emitter/EventValidator.js @@ -71,21 +71,21 @@ if (__DEV__) { } }; - var closestTypeFor = function(type, allowedTypes) { + const closestTypeFor = function(type, allowedTypes) { const typeRecommendations = allowedTypes.map( typeRecommendationFor.bind(this, type), ); return typeRecommendations.sort(recommendationSort)[0]; }; - var typeRecommendationFor = function(type, recommendedType) { + const typeRecommendationFor = function(type, recommendedType) { return { type: recommendedType, distance: damerauLevenshteinDistance(type, recommendedType), }; }; - var recommendationSort = function(recommendationA, recommendationB) { + const recommendationSort = function(recommendationA, recommendationB) { if (recommendationA.distance < recommendationB.distance) { return -1; } else if (recommendationA.distance > recommendationB.distance) { @@ -95,11 +95,11 @@ if (__DEV__) { } }; - var isCloseEnough = function(closestType, actualType) { + const isCloseEnough = function(closestType, actualType) { return closestType.distance / actualType.length < 0.334; }; - var damerauLevenshteinDistance = function(a, b) { + const damerauLevenshteinDistance = function(a, b) { let i, j; const d = [];