Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion .babelrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
{
"presets": ["env"]
"presets": [
[
"@babel/preset-env",
{
"loose": true
}
]
],
"plugins": ["@babel/plugin-transform-flow-strip-types"]
}
6 changes: 2 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//
"use strict";

module.exports = function shallowEqual(objA, objB, compare, compareContext) {
var ret = compare ? compare.call(compareContext, objA, objB) : void 0;
Expand All @@ -22,9 +22,8 @@ module.exports = function shallowEqual(objA, objB, compare, compareContext) {
return false;
}

var bHasOwnProperty = Object.prototype.hasOwnProperty.bind(objB);
var bHasOwnProperty = Object.prototype.hasOwnProperty.bind(objB); // Test for A's keys different from B.

// Test for A's keys different from B.
for (var idx = 0; idx < keysA.length; idx++) {
var key = keysA[idx];

Expand All @@ -34,7 +33,6 @@ module.exports = function shallowEqual(objA, objB, compare, compareContext) {

var valueA = objA[key];
var valueB = objB[key];

ret = compare ? compare.call(compareContext, valueA, valueB, key) : void 0;

if (ret === false || (ret === void 0 && valueA !== valueB)) {
Expand Down
15 changes: 10 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@
"scripts": {
"lint": "eslint index.js test",
"test": "jest .",
"prepare": "npm run flow:check && npm run pretty && npm run lint && npm run test",
"travis": "npm run flow:check && npm run lint && npm run test",
"prepare": "npm run build && npm run pretty && npm run flow:check && npm run lint && npm run test",
"travis": "npm run prepare",
"pretty": "prettier --write --tab-width 2 'test/**/*.js' '*.{js,json,js.flow,md}'",
"precommit": "lint-staged",
"flow:check": "flow check"
"flow:check": "flow check",
"build": "babel index.original.js > index.js"
},
"lint-staged": {
"*.{js,json,js.flow,md}": [
Expand Down Expand Up @@ -53,14 +54,18 @@
]
},
"devDependencies": {
"@babel/cli": "^7.2.3",
"@babel/core": "^7.2.2",
"@babel/plugin-transform-flow-strip-types": "^7.2.3",
"@babel/preset-env": "^7.3.1",
"babel-eslint": "^10.0.1",
"babel-jest": "^23.6.0",
"babel-jest": "^24.0.0",
"babel-preset-env": "^1.7.0",
"eslint": "^5.12.0",
"eslint-plugin-jest": "^22.1.3",
"flow-bin": "^0.92.1",
"husky": "^1.3.1",
"jest": "^23.6.0",
"jest": "^24.0.0",
"lint-staged": "^8.1.0",
"prettier": "^1.15.3"
}
Expand Down
Loading