2015-01-29 17:10:49 -08:00
|
|
|
/**
|
2015-03-23 15:07:33 -07:00
|
|
|
* Copyright (c) 2015-present, Facebook, Inc.
|
|
|
|
*
|
2018-02-16 18:24:55 -08:00
|
|
|
* This source code is licensed under the MIT license found in the
|
|
|
|
* LICENSE file in the root directory of this source tree.
|
2015-01-29 17:10:49 -08:00
|
|
|
*
|
2018-05-10 19:06:46 -07:00
|
|
|
* @format
|
2015-03-24 09:26:16 -07:00
|
|
|
* @flow
|
2015-01-29 17:10:49 -08:00
|
|
|
*/
|
2018-05-10 19:06:46 -07:00
|
|
|
|
2015-01-29 17:10:49 -08:00
|
|
|
'use strict';
|
|
|
|
|
2015-03-24 09:26:16 -07:00
|
|
|
type Inset = {
|
2016-08-09 06:32:41 -07:00
|
|
|
top: ?number,
|
|
|
|
left: ?number,
|
|
|
|
right: ?number,
|
|
|
|
bottom: ?number,
|
2018-05-10 19:06:46 -07:00
|
|
|
};
|
2015-03-24 09:26:16 -07:00
|
|
|
|
2018-05-10 15:44:52 -07:00
|
|
|
const dummyInsets = {
|
2018-05-10 19:06:46 -07:00
|
|
|
top: undefined,
|
|
|
|
left: undefined,
|
|
|
|
right: undefined,
|
|
|
|
bottom: undefined,
|
2015-01-29 17:10:49 -08:00
|
|
|
};
|
|
|
|
|
2018-05-10 19:06:46 -07:00
|
|
|
const insetsDiffer = function(one: ?Inset, two: ?Inset): boolean {
|
2015-01-29 17:10:49 -08:00
|
|
|
one = one || dummyInsets;
|
|
|
|
two = two || dummyInsets;
|
2018-05-10 19:06:46 -07:00
|
|
|
return (
|
|
|
|
one !== two &&
|
|
|
|
(one.top !== two.top ||
|
|
|
|
one.left !== two.left ||
|
|
|
|
one.right !== two.right ||
|
|
|
|
one.bottom !== two.bottom)
|
2015-01-29 17:10:49 -08:00
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = insetsDiffer;
|