@x-oasis/layout-equal 0.1.14 → 0.1.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +4 -1
- package/dist/layout-equal.cjs.development.js +4 -5
- package/dist/layout-equal.cjs.development.js.map +1 -1
- package/dist/layout-equal.cjs.production.min.js +1 -1
- package/dist/layout-equal.cjs.production.min.js.map +1 -1
- package/dist/layout-equal.esm.js +4 -5
- package/dist/layout-equal.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +7 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,5 @@
|
|
|
1
1
|
import { ItemLayout } from './types';
|
|
2
|
-
export default function layoutEqual(oldLayout: ItemLayout, newLayout: ItemLayout,
|
|
2
|
+
export default function layoutEqual(oldLayout: ItemLayout, newLayout: ItemLayout, options?: {
|
|
3
|
+
keysToCheck?: Array<'x' | 'y' | 'height' | 'width'>;
|
|
4
|
+
correctionValue?: number;
|
|
5
|
+
}): boolean;
|
|
@@ -3,16 +3,15 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var KEY_TO_CHECK = ['x', 'y', 'height', 'width'];
|
|
6
|
-
function layoutEqual(oldLayout, newLayout,
|
|
7
|
-
if (keysToCheck === void 0) {
|
|
8
|
-
keysToCheck = KEY_TO_CHECK;
|
|
9
|
-
}
|
|
6
|
+
function layoutEqual(oldLayout, newLayout, options) {
|
|
10
7
|
var oldLayoutType = Object.prototype.toString.call(oldLayout);
|
|
11
8
|
var newLayoutType = Object.prototype.toString.call(newLayout);
|
|
9
|
+
var keysToCheck = (options == null ? void 0 : options.keysToCheck) || KEY_TO_CHECK;
|
|
10
|
+
var correctionValue = (options == null ? void 0 : options.correctionValue) || 0;
|
|
12
11
|
if (oldLayoutType === newLayoutType && newLayoutType === '[object Object]') {
|
|
13
12
|
for (var index = 0; index < keysToCheck.length; index++) {
|
|
14
13
|
var key = keysToCheck[index];
|
|
15
|
-
if (oldLayout[key]
|
|
14
|
+
if (Math.abs(oldLayout[key] - newLayout[key]) > correctionValue) {
|
|
16
15
|
return false;
|
|
17
16
|
}
|
|
18
17
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout-equal.cjs.development.js","sources":["../src/index.ts"],"sourcesContent":["import { ItemLayout } from './types';\n\nconst KEY_TO_CHECK = ['x', 'y', 'height', 'width'];\n\nexport default function layoutEqual(\n oldLayout: ItemLayout,\n newLayout: ItemLayout,\n
|
|
1
|
+
{"version":3,"file":"layout-equal.cjs.development.js","sources":["../src/index.ts"],"sourcesContent":["import { ItemLayout } from './types';\n\nconst KEY_TO_CHECK = ['x', 'y', 'height', 'width'];\n\nexport default function layoutEqual(\n oldLayout: ItemLayout,\n newLayout: ItemLayout,\n options?: {\n keysToCheck?: Array<'x' | 'y' | 'height' | 'width'>;\n correctionValue?: number;\n }\n) {\n const oldLayoutType = Object.prototype.toString.call(oldLayout);\n const newLayoutType = Object.prototype.toString.call(newLayout);\n const keysToCheck = options?.keysToCheck || KEY_TO_CHECK;\n const correctionValue = options?.correctionValue || 0;\n\n if (oldLayoutType === newLayoutType && newLayoutType === '[object Object]') {\n for (let index = 0; index < keysToCheck.length; index++) {\n const key = keysToCheck[index];\n if (Math.abs(oldLayout[key] - newLayout[key]) > correctionValue) {\n return false;\n }\n }\n\n return true;\n }\n\n return false;\n}\n"],"names":["KEY_TO_CHECK","layoutEqual","oldLayout","newLayout","options","oldLayoutType","Object","prototype","toString","call","newLayoutType","keysToCheck","correctionValue","index","length","key","Math","abs"],"mappings":";;;;AAEA,IAAMA,YAAY,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,QAAQ,EAAE,OAAO,CAAC;SAE1BC,WAAWA,CACjCC,SAAqB,EACrBC,SAAqB,EACrBC,OAGC;EAED,IAAMC,aAAa,GAAGC,MAAM,CAACC,SAAS,CAACC,QAAQ,CAACC,IAAI,CAACP,SAAS,CAAC;EAC/D,IAAMQ,aAAa,GAAGJ,MAAM,CAACC,SAAS,CAACC,QAAQ,CAACC,IAAI,CAACN,SAAS,CAAC;EAC/D,IAAMQ,WAAW,GAAG,CAAAP,OAAO,oBAAPA,OAAO,CAAEO,WAAW,KAAIX,YAAY;EACxD,IAAMY,eAAe,GAAG,CAAAR,OAAO,oBAAPA,OAAO,CAAEQ,eAAe,KAAI,CAAC;EAErD,IAAIP,aAAa,KAAKK,aAAa,IAAIA,aAAa,KAAK,iBAAiB,EAAE;IAC1E,KAAK,IAAIG,KAAK,GAAG,CAAC,EAAEA,KAAK,GAAGF,WAAW,CAACG,MAAM,EAAED,KAAK,EAAE,EAAE;MACvD,IAAME,GAAG,GAAGJ,WAAW,CAACE,KAAK,CAAC;MAC9B,IAAIG,IAAI,CAACC,GAAG,CAACf,SAAS,CAACa,GAAG,CAAC,GAAGZ,SAAS,CAACY,GAAG,CAAC,CAAC,GAAGH,eAAe,EAAE;QAC/D,OAAO,KAAK;;;IAIhB,OAAO,IAAI;;EAGb,OAAO,KAAK;AACd;;;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=["x","y","height","width"];exports.default=function(e,r,o){
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=["x","y","height","width"];exports.default=function(e,r,o){var l=Object.prototype.toString.call(e),c=Object.prototype.toString.call(r),i=(null==o?void 0:o.keysToCheck)||t,n=(null==o?void 0:o.correctionValue)||0;if(l===c&&"[object Object]"===c){for(var a=0;a<i.length;a++){var u=i[a];if(Math.abs(e[u]-r[u])>n)return!1}return!0}return!1};
|
|
2
2
|
//# sourceMappingURL=layout-equal.cjs.production.min.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout-equal.cjs.production.min.js","sources":["../src/index.ts"],"sourcesContent":["import { ItemLayout } from './types';\n\nconst KEY_TO_CHECK = ['x', 'y', 'height', 'width'];\n\nexport default function layoutEqual(\n oldLayout: ItemLayout,\n newLayout: ItemLayout,\n
|
|
1
|
+
{"version":3,"file":"layout-equal.cjs.production.min.js","sources":["../src/index.ts"],"sourcesContent":["import { ItemLayout } from './types';\n\nconst KEY_TO_CHECK = ['x', 'y', 'height', 'width'];\n\nexport default function layoutEqual(\n oldLayout: ItemLayout,\n newLayout: ItemLayout,\n options?: {\n keysToCheck?: Array<'x' | 'y' | 'height' | 'width'>;\n correctionValue?: number;\n }\n) {\n const oldLayoutType = Object.prototype.toString.call(oldLayout);\n const newLayoutType = Object.prototype.toString.call(newLayout);\n const keysToCheck = options?.keysToCheck || KEY_TO_CHECK;\n const correctionValue = options?.correctionValue || 0;\n\n if (oldLayoutType === newLayoutType && newLayoutType === '[object Object]') {\n for (let index = 0; index < keysToCheck.length; index++) {\n const key = keysToCheck[index];\n if (Math.abs(oldLayout[key] - newLayout[key]) > correctionValue) {\n return false;\n }\n }\n\n return true;\n }\n\n return false;\n}\n"],"names":["KEY_TO_CHECK","oldLayout","newLayout","options","oldLayoutType","Object","prototype","toString","call","newLayoutType","keysToCheck","correctionValue","index","length","key","Math","abs"],"mappings":"oEAEA,IAAMA,EAAe,CAAC,IAAK,IAAK,SAAU,kCAGxCC,EACAC,EACAC,GAKA,IAAMC,EAAgBC,OAAOC,UAAUC,SAASC,KAAKP,GAC/CQ,EAAgBJ,OAAOC,UAAUC,SAASC,KAAKN,GAC/CQ,SAAcP,SAAAA,EAASO,cAAeV,EACtCW,SAAkBR,SAAAA,EAASQ,kBAAmB,EAEpD,GAAIP,IAAkBK,GAAmC,oBAAlBA,EAAqC,CAC1E,IAAK,IAAIG,EAAQ,EAAGA,EAAQF,EAAYG,OAAQD,IAAS,CACvD,IAAME,EAAMJ,EAAYE,GACxB,GAAIG,KAAKC,IAAIf,EAAUa,GAAOZ,EAAUY,IAAQH,EAC9C,OAAO,EAIX,OAAO,EAGT,OAAO"}
|
package/dist/layout-equal.esm.js
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
var KEY_TO_CHECK = ['x', 'y', 'height', 'width'];
|
|
2
|
-
function layoutEqual(oldLayout, newLayout,
|
|
3
|
-
if (keysToCheck === void 0) {
|
|
4
|
-
keysToCheck = KEY_TO_CHECK;
|
|
5
|
-
}
|
|
2
|
+
function layoutEqual(oldLayout, newLayout, options) {
|
|
6
3
|
var oldLayoutType = Object.prototype.toString.call(oldLayout);
|
|
7
4
|
var newLayoutType = Object.prototype.toString.call(newLayout);
|
|
5
|
+
var keysToCheck = (options == null ? void 0 : options.keysToCheck) || KEY_TO_CHECK;
|
|
6
|
+
var correctionValue = (options == null ? void 0 : options.correctionValue) || 0;
|
|
8
7
|
if (oldLayoutType === newLayoutType && newLayoutType === '[object Object]') {
|
|
9
8
|
for (var index = 0; index < keysToCheck.length; index++) {
|
|
10
9
|
var key = keysToCheck[index];
|
|
11
|
-
if (oldLayout[key]
|
|
10
|
+
if (Math.abs(oldLayout[key] - newLayout[key]) > correctionValue) {
|
|
12
11
|
return false;
|
|
13
12
|
}
|
|
14
13
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout-equal.esm.js","sources":["../src/index.ts"],"sourcesContent":["import { ItemLayout } from './types';\n\nconst KEY_TO_CHECK = ['x', 'y', 'height', 'width'];\n\nexport default function layoutEqual(\n oldLayout: ItemLayout,\n newLayout: ItemLayout,\n
|
|
1
|
+
{"version":3,"file":"layout-equal.esm.js","sources":["../src/index.ts"],"sourcesContent":["import { ItemLayout } from './types';\n\nconst KEY_TO_CHECK = ['x', 'y', 'height', 'width'];\n\nexport default function layoutEqual(\n oldLayout: ItemLayout,\n newLayout: ItemLayout,\n options?: {\n keysToCheck?: Array<'x' | 'y' | 'height' | 'width'>;\n correctionValue?: number;\n }\n) {\n const oldLayoutType = Object.prototype.toString.call(oldLayout);\n const newLayoutType = Object.prototype.toString.call(newLayout);\n const keysToCheck = options?.keysToCheck || KEY_TO_CHECK;\n const correctionValue = options?.correctionValue || 0;\n\n if (oldLayoutType === newLayoutType && newLayoutType === '[object Object]') {\n for (let index = 0; index < keysToCheck.length; index++) {\n const key = keysToCheck[index];\n if (Math.abs(oldLayout[key] - newLayout[key]) > correctionValue) {\n return false;\n }\n }\n\n return true;\n }\n\n return false;\n}\n"],"names":["KEY_TO_CHECK","layoutEqual","oldLayout","newLayout","options","oldLayoutType","Object","prototype","toString","call","newLayoutType","keysToCheck","correctionValue","index","length","key","Math","abs"],"mappings":"AAEA,IAAMA,YAAY,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,QAAQ,EAAE,OAAO,CAAC;SAE1BC,WAAWA,CACjCC,SAAqB,EACrBC,SAAqB,EACrBC,OAGC;EAED,IAAMC,aAAa,GAAGC,MAAM,CAACC,SAAS,CAACC,QAAQ,CAACC,IAAI,CAACP,SAAS,CAAC;EAC/D,IAAMQ,aAAa,GAAGJ,MAAM,CAACC,SAAS,CAACC,QAAQ,CAACC,IAAI,CAACN,SAAS,CAAC;EAC/D,IAAMQ,WAAW,GAAG,CAAAP,OAAO,oBAAPA,OAAO,CAAEO,WAAW,KAAIX,YAAY;EACxD,IAAMY,eAAe,GAAG,CAAAR,OAAO,oBAAPA,OAAO,CAAEQ,eAAe,KAAI,CAAC;EAErD,IAAIP,aAAa,KAAKK,aAAa,IAAIA,aAAa,KAAK,iBAAiB,EAAE;IAC1E,KAAK,IAAIG,KAAK,GAAG,CAAC,EAAEA,KAAK,GAAGF,WAAW,CAACG,MAAM,EAAED,KAAK,EAAE,EAAE;MACvD,IAAME,GAAG,GAAGJ,WAAW,CAACE,KAAK,CAAC;MAC9B,IAAIG,IAAI,CAACC,GAAG,CAACf,SAAS,CAACa,GAAG,CAAC,GAAGZ,SAAS,CAACY,GAAG,CAAC,CAAC,GAAGH,eAAe,EAAE;QAC/D,OAAO,KAAK;;;IAIhB,OAAO,IAAI;;EAGb,OAAO,KAAK;AACd;;;;"}
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -5,16 +5,20 @@ const KEY_TO_CHECK = ['x', 'y', 'height', 'width'];
|
|
|
5
5
|
export default function layoutEqual(
|
|
6
6
|
oldLayout: ItemLayout,
|
|
7
7
|
newLayout: ItemLayout,
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
options?: {
|
|
9
|
+
keysToCheck?: Array<'x' | 'y' | 'height' | 'width'>;
|
|
10
|
+
correctionValue?: number;
|
|
11
|
+
}
|
|
10
12
|
) {
|
|
11
13
|
const oldLayoutType = Object.prototype.toString.call(oldLayout);
|
|
12
14
|
const newLayoutType = Object.prototype.toString.call(newLayout);
|
|
15
|
+
const keysToCheck = options?.keysToCheck || KEY_TO_CHECK;
|
|
16
|
+
const correctionValue = options?.correctionValue || 0;
|
|
13
17
|
|
|
14
18
|
if (oldLayoutType === newLayoutType && newLayoutType === '[object Object]') {
|
|
15
19
|
for (let index = 0; index < keysToCheck.length; index++) {
|
|
16
20
|
const key = keysToCheck[index];
|
|
17
|
-
if (oldLayout[key]
|
|
21
|
+
if (Math.abs(oldLayout[key] - newLayout[key]) > correctionValue) {
|
|
18
22
|
return false;
|
|
19
23
|
}
|
|
20
24
|
}
|