Skip to content

Commit

Permalink
ESLint: Enforce object destructuring
Browse files Browse the repository at this point in the history
This is a follow-up to #236
We could also do array destructuring, but it looked a little
weird to me, so I left it out for now.
  • Loading branch information
josephfrazier authored and slevithan committed Apr 19, 2018
1 parent 7ee5818 commit cc11a5d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ module.exports = {
"error",
{
"array": false,
"object": false
"object": true
}
],
"prefer-numeric-literals": "error",
Expand Down
2 changes: 1 addition & 1 deletion src/addons/matchrecursive.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export default (XRegExp) => {
const sticky = flags.includes('y');
// Flag `y` is controlled internally
const basicFlags = flags.replace(/y/g, '');
let escapeChar = options.escapeChar;
let {escapeChar} = options;
const vN = options.valueNames;
const output = [];
let openTokens = 0;
Expand Down
4 changes: 2 additions & 2 deletions src/xregexp.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ const correctExecNpcg = nativ.exec.call(/()??/, '')[1] === undefined;
// Check for ES6 `flags` prop support
const hasFlagsProp = /x/.flags !== undefined;
// Shortcut to `Object.prototype.toString`
const toString = {}.toString;
const {toString} = {};

function hasNativeFlag(flag) {
// Can't check based on the presence of properties/getters since browsers might support such
Expand Down Expand Up @@ -1501,7 +1501,7 @@ fixed.replace = function(search, replacement) {

if (isRegex) {
if (search[REGEX_DATA]) {
captureNames = search[REGEX_DATA].captureNames;
({captureNames} = search[REGEX_DATA]);
}
// Only needed if `search` is nonglobal
origLastIndex = search.lastIndex;
Expand Down

0 comments on commit cc11a5d

Please sign in to comment.