Skip to content

Commit

Permalink
[Refactor] add strict pragma; remove unused try/catch
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Mar 6, 2020
1 parent c1814a1 commit c1d173e
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 7 deletions.
1 change: 0 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
"new-cap": [2, { "capIsNewExceptions": ["GetIntrinsic"] }],
"no-magic-numbers": [2, { "ignore": [0, 1] }],
"operator-linebreak": [2, "before"],
"strict": 1,
},
"globals": {
"WeakMap": false,
Expand Down
2 changes: 2 additions & 0 deletions assert.js
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
'use strict';

module.exports = require('assert');
2 changes: 2 additions & 0 deletions example/cmp.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

var equal = require('../');
console.dir([
equal(
Expand Down
10 changes: 4 additions & 6 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

var objectKeys = require('object-keys');
var isArguments = require('is-arguments');
var is = require('object-is');
Expand Down Expand Up @@ -315,12 +317,8 @@ function objEquiv(a, b, opts, channel) {

if (typeof a !== typeof b) { return false; }

try {
var ka = objectKeys(a);
var kb = objectKeys(b);
} catch (e) { // happens when one is a string literal and the other isn't
return false;
}
var ka = objectKeys(a);
var kb = objectKeys(b);
// having the same number of owned properties (keys incorporates hasOwnProperty)
if (ka.length !== kb.length) { return false; }

Expand Down
2 changes: 2 additions & 0 deletions test/_tape.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

var Test = require('tape/lib/test');
var is = require('object-is');

Expand Down
2 changes: 2 additions & 0 deletions test/cmp.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

var test = require('tape');
require('./_tape');
var assign = require('object.assign');
Expand Down

0 comments on commit c1d173e

Please sign in to comment.