Skip to content

Commit 057b9ac

Browse files
committed
refactor: don't destruct Object
1 parent 9ff0f5f commit 057b9ac

File tree

3 files changed

+3
-9
lines changed

3 files changed

+3
-9
lines changed

__mocks__/genInteractives.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ import JSXElementMock from './JSXElementMock';
1010
import type { JSXAttributeMockType } from './JSXAttributeMock';
1111
import type { JSXElementMockType } from './JSXElementMock';
1212

13-
const { fromEntries } = Object;
14-
1513
const domElements = dom.keys();
1614
const roleNames = roles.keys();
1715

@@ -122,7 +120,7 @@ const nonInteractiveElementsMap: {[string]: Array<{[string]: string}>} = {
122120
ul: [],
123121
};
124122

125-
const indeterminantInteractiveElementsMap: { [key: string]: Array<any> } = fromEntries(domElements.map((name) => [name, []]));
123+
const indeterminantInteractiveElementsMap: { [key: string]: Array<any> } = Object.fromEntries(domElements.map((name) => [name, []]));
126124

127125
Object.keys(interactiveElementsMap)
128126
.concat(Object.keys(nonInteractiveElementsMap))

__tests__/__util__/ruleOptionsMapperFactory.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
* @flow
33
*/
44

5-
const { fromEntries, entries } = Object;
6-
75
type ESLintTestRunnerTestCase = {
86
code: string,
97
errors: ?Array<{ message: string, type: string }>,
@@ -23,7 +21,7 @@ export default function ruleOptionsMapperFactory(ruleOptions: Array<mixed> = [])
2321
code,
2422
errors,
2523
// Flatten the array of objects in an array of one object.
26-
options: [fromEntries((options || []).concat(ruleOptions).flatMap((item) => entries((item: any))))],
24+
options: [Object.fromEntries((options || []).concat(ruleOptions).flatMap((item) => Object.entries((item: any))))],
2725
parserOptions,
2826
settings,
2927
};

src/util/getSuggestion.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import editDistance from 'damerau-levenshtein';
22

3-
const { fromEntries } = Object;
4-
53
// Minimum edit distance to be considered a good suggestion.
64
const THRESHOLD = 2;
75

@@ -10,7 +8,7 @@ const THRESHOLD = 2;
108
* to return.
119
*/
1210
export default function getSuggestion(word, dictionary = [], limit = 2) {
13-
const distances = fromEntries(
11+
const distances = Object.fromEntries(
1412
dictionary.map((dictionaryWord) => {
1513
const distance = editDistance(word.toUpperCase(), dictionaryWord.toUpperCase());
1614
const { steps } = distance;

0 commit comments

Comments
 (0)