Skip to content

Commit b0fc3a9

Browse files
committed
refactor: don't destruct Object
1 parent 2b6bf78 commit b0fc3a9

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
@@ -4,8 +4,6 @@
44

55
import flatMap from 'array.prototype.flatmap';
66

7-
const { fromEntries, entries } = Object;
8-
97
type ESLintTestRunnerTestCase = {
108
code: string,
119
errors: ?Array<{ message: string, type: string }>,
@@ -25,7 +23,7 @@ export default function ruleOptionsMapperFactory(ruleOptions: Array<mixed> = [])
2523
code,
2624
errors,
2725
// Flatten the array of objects in an array of one object.
28-
options: [fromEntries(flatMap((options || []).concat(ruleOptions), (item) => entries(item)))],
26+
options: [Object.fromEntries(flatMap((options || []).concat(ruleOptions), (item) => Object.entries(item)))],
2927
parserOptions,
3028
settings,
3129
};

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)