@x-oasis/layout-equal 0.1.12 → 0.1.13
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 +1 -1
- package/dist/layout-equal.cjs.development.js +8 -4
- 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 +8 -4
- package/dist/layout-equal.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +8 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ItemLayout } from './types';
|
|
2
|
-
export default function layoutEqual(oldLayout: ItemLayout, newLayout: ItemLayout): boolean;
|
|
2
|
+
export default function layoutEqual(oldLayout: ItemLayout, newLayout: ItemLayout, keysToCheck?: Array<'x' | 'y' | 'height' | 'width'>): boolean;
|
|
@@ -2,13 +2,17 @@
|
|
|
2
2
|
|
|
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, keysToCheck) {
|
|
7
|
+
if (keysToCheck === void 0) {
|
|
8
|
+
keysToCheck = KEY_TO_CHECK;
|
|
9
|
+
}
|
|
6
10
|
var oldLayoutType = Object.prototype.toString.call(oldLayout);
|
|
7
11
|
var newLayoutType = Object.prototype.toString.call(newLayout);
|
|
8
12
|
if (oldLayoutType === newLayoutType && newLayoutType === '[object Object]') {
|
|
9
|
-
var
|
|
10
|
-
|
|
11
|
-
|
|
13
|
+
for (var index = 0; index < KEY_TO_CHECK.length; index++) {
|
|
14
|
+
var key = KEY_TO_CHECK[index];
|
|
15
|
+
if (!(key in keysToCheck)) continue;
|
|
12
16
|
if (oldLayout[key] !== newLayout[key]) {
|
|
13
17
|
return false;
|
|
14
18
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout-equal.cjs.development.js","sources":["../src/index.ts"],"sourcesContent":["import { ItemLayout } from './types';\n\nexport default function layoutEqual(\n oldLayout: ItemLayout,\n newLayout: ItemLayout\n) {\n const oldLayoutType = Object.prototype.toString.call(oldLayout);\n const newLayoutType = Object.prototype.toString.call(newLayout);\n\n if (oldLayoutType === newLayoutType && newLayoutType === '[object Object]') {\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 // @ts-ignore\n keysToCheck: Array<'x' | 'y' | 'height' | 'width'> = KEY_TO_CHECK\n) {\n const oldLayoutType = Object.prototype.toString.call(oldLayout);\n const newLayoutType = Object.prototype.toString.call(newLayout);\n\n if (oldLayoutType === newLayoutType && newLayoutType === '[object Object]') {\n for (let index = 0; index < KEY_TO_CHECK.length; index++) {\n const key = KEY_TO_CHECK[index];\n if (!(key in keysToCheck)) continue;\n if (oldLayout[key] !== newLayout[key]) {\n return false;\n }\n }\n\n return true;\n }\n\n return false;\n}\n"],"names":["KEY_TO_CHECK","layoutEqual","oldLayout","newLayout","keysToCheck","oldLayoutType","Object","prototype","toString","call","newLayoutType","index","length","key"],"mappings":";;;;AAEA,IAAMA,YAAY,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,QAAQ,EAAE,OAAO,CAAC;SAE1BC,WAAWA,CACjCC,SAAqB,EACrBC,SAAqB,EAErBC;MAAAA;IAAAA,cAAqDJ,YAAY;;EAEjE,IAAMK,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;EAE/D,IAAIE,aAAa,KAAKK,aAAa,IAAIA,aAAa,KAAK,iBAAiB,EAAE;IAC1E,KAAK,IAAIC,KAAK,GAAG,CAAC,EAAEA,KAAK,GAAGX,YAAY,CAACY,MAAM,EAAED,KAAK,EAAE,EAAE;MACxD,IAAME,GAAG,GAAGb,YAAY,CAACW,KAAK,CAAC;MAC/B,IAAI,EAAEE,GAAG,IAAIT,WAAW,CAAC,EAAE;MAC3B,IAAIF,SAAS,CAACW,GAAG,CAAC,KAAKV,SAAS,CAACU,GAAG,CAAC,EAAE;QACrC,OAAO,KAAK;;;IAIhB,OAAO,IAAI;;EAGb,OAAO,KAAK;AACd;;;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=function(
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=["x","y","height","width"];exports.default=function(e,r,o){void 0===o&&(o=t);var i=Object.prototype.toString.call(e),n=Object.prototype.toString.call(r);if(i===n&&"[object Object]"===n){for(var c=0;c<t.length;c++){var a=t[c];if(a in o&&e[a]!==r[a])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\nexport default function layoutEqual(\n oldLayout: ItemLayout,\n newLayout: ItemLayout\n) {\n const oldLayoutType = Object.prototype.toString.call(oldLayout);\n const newLayoutType = Object.prototype.toString.call(newLayout);\n\n if (oldLayoutType === newLayoutType && newLayoutType === '[object Object]') {\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 // @ts-ignore\n keysToCheck: Array<'x' | 'y' | 'height' | 'width'> = KEY_TO_CHECK\n) {\n const oldLayoutType = Object.prototype.toString.call(oldLayout);\n const newLayoutType = Object.prototype.toString.call(newLayout);\n\n if (oldLayoutType === newLayoutType && newLayoutType === '[object Object]') {\n for (let index = 0; index < KEY_TO_CHECK.length; index++) {\n const key = KEY_TO_CHECK[index];\n if (!(key in keysToCheck)) continue;\n if (oldLayout[key] !== newLayout[key]) {\n return false;\n }\n }\n\n return true;\n }\n\n return false;\n}\n"],"names":["KEY_TO_CHECK","oldLayout","newLayout","keysToCheck","oldLayoutType","Object","prototype","toString","call","newLayoutType","index","length","key"],"mappings":"oEAEA,IAAMA,EAAe,CAAC,IAAK,IAAK,SAAU,kCAGxCC,EACAC,EAEAC,YAAAA,IAAAA,EAAqDH,GAErD,IAAMI,EAAgBC,OAAOC,UAAUC,SAASC,KAAKP,GAC/CQ,EAAgBJ,OAAOC,UAAUC,SAASC,KAAKN,GAErD,GAAIE,IAAkBK,GAAmC,oBAAlBA,EAAqC,CAC1E,IAAK,IAAIC,EAAQ,EAAGA,EAAQV,EAAaW,OAAQD,IAAS,CACxD,IAAME,EAAMZ,EAAaU,GACzB,GAAME,KAAOT,GACTF,EAAUW,KAASV,EAAUU,GAC/B,OAAO,EAIX,OAAO,EAGT,OAAO"}
|
package/dist/layout-equal.esm.js
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
var KEY_TO_CHECK = ['x', 'y', 'height', 'width'];
|
|
2
|
+
function layoutEqual(oldLayout, newLayout, keysToCheck) {
|
|
3
|
+
if (keysToCheck === void 0) {
|
|
4
|
+
keysToCheck = KEY_TO_CHECK;
|
|
5
|
+
}
|
|
2
6
|
var oldLayoutType = Object.prototype.toString.call(oldLayout);
|
|
3
7
|
var newLayoutType = Object.prototype.toString.call(newLayout);
|
|
4
8
|
if (oldLayoutType === newLayoutType && newLayoutType === '[object Object]') {
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
|
|
9
|
+
for (var index = 0; index < KEY_TO_CHECK.length; index++) {
|
|
10
|
+
var key = KEY_TO_CHECK[index];
|
|
11
|
+
if (!(key in keysToCheck)) continue;
|
|
8
12
|
if (oldLayout[key] !== newLayout[key]) {
|
|
9
13
|
return false;
|
|
10
14
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout-equal.esm.js","sources":["../src/index.ts"],"sourcesContent":["import { ItemLayout } from './types';\n\nexport default function layoutEqual(\n oldLayout: ItemLayout,\n newLayout: ItemLayout\n) {\n const oldLayoutType = Object.prototype.toString.call(oldLayout);\n const newLayoutType = Object.prototype.toString.call(newLayout);\n\n if (oldLayoutType === newLayoutType && newLayoutType === '[object Object]') {\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 // @ts-ignore\n keysToCheck: Array<'x' | 'y' | 'height' | 'width'> = KEY_TO_CHECK\n) {\n const oldLayoutType = Object.prototype.toString.call(oldLayout);\n const newLayoutType = Object.prototype.toString.call(newLayout);\n\n if (oldLayoutType === newLayoutType && newLayoutType === '[object Object]') {\n for (let index = 0; index < KEY_TO_CHECK.length; index++) {\n const key = KEY_TO_CHECK[index];\n if (!(key in keysToCheck)) continue;\n if (oldLayout[key] !== newLayout[key]) {\n return false;\n }\n }\n\n return true;\n }\n\n return false;\n}\n"],"names":["KEY_TO_CHECK","layoutEqual","oldLayout","newLayout","keysToCheck","oldLayoutType","Object","prototype","toString","call","newLayoutType","index","length","key"],"mappings":"AAEA,IAAMA,YAAY,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,QAAQ,EAAE,OAAO,CAAC;SAE1BC,WAAWA,CACjCC,SAAqB,EACrBC,SAAqB,EAErBC;MAAAA;IAAAA,cAAqDJ,YAAY;;EAEjE,IAAMK,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;EAE/D,IAAIE,aAAa,KAAKK,aAAa,IAAIA,aAAa,KAAK,iBAAiB,EAAE;IAC1E,KAAK,IAAIC,KAAK,GAAG,CAAC,EAAEA,KAAK,GAAGX,YAAY,CAACY,MAAM,EAAED,KAAK,EAAE,EAAE;MACxD,IAAME,GAAG,GAAGb,YAAY,CAACW,KAAK,CAAC;MAC/B,IAAI,EAAEE,GAAG,IAAIT,WAAW,CAAC,EAAE;MAC3B,IAAIF,SAAS,CAACW,GAAG,CAAC,KAAKV,SAAS,CAACU,GAAG,CAAC,EAAE;QACrC,OAAO,KAAK;;;IAIhB,OAAO,IAAI;;EAGb,OAAO,KAAK;AACd;;;;"}
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
import { ItemLayout } from './types';
|
|
2
2
|
|
|
3
|
+
const KEY_TO_CHECK = ['x', 'y', 'height', 'width'];
|
|
4
|
+
|
|
3
5
|
export default function layoutEqual(
|
|
4
6
|
oldLayout: ItemLayout,
|
|
5
|
-
newLayout: ItemLayout
|
|
7
|
+
newLayout: ItemLayout,
|
|
8
|
+
// @ts-ignore
|
|
9
|
+
keysToCheck: Array<'x' | 'y' | 'height' | 'width'> = KEY_TO_CHECK
|
|
6
10
|
) {
|
|
7
11
|
const oldLayoutType = Object.prototype.toString.call(oldLayout);
|
|
8
12
|
const newLayoutType = Object.prototype.toString.call(newLayout);
|
|
9
13
|
|
|
10
14
|
if (oldLayoutType === newLayoutType && newLayoutType === '[object Object]') {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
15
|
+
for (let index = 0; index < KEY_TO_CHECK.length; index++) {
|
|
16
|
+
const key = KEY_TO_CHECK[index];
|
|
17
|
+
if (!(key in keysToCheck)) continue;
|
|
14
18
|
if (oldLayout[key] !== newLayout[key]) {
|
|
15
19
|
return false;
|
|
16
20
|
}
|