@x-oasis/layout-equal 0.1.11 → 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 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
- function layoutEqual(oldLayout, newLayout) {
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 keys = ['x', 'y', 'height', 'width'];
10
- for (var index = 0; index < keys.length; index++) {
11
- var key = keys[index];
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 const keys = ['x', 'y', 'height', 'width'];\n for (let index = 0; index < keys.length; index++) {\n const key = keys[index];\n if (oldLayout[key] !== newLayout[key]) {\n return false;\n }\n }\n\n return true;\n }\n\n return false;\n}\n"],"names":["layoutEqual","oldLayout","newLayout","oldLayoutType","Object","prototype","toString","call","newLayoutType","keys","index","length","key"],"mappings":";;;;SAEwBA,WAAWA,CACjCC,SAAqB,EACrBC,SAAqB;EAErB,IAAMC,aAAa,GAAGC,MAAM,CAACC,SAAS,CAACC,QAAQ,CAACC,IAAI,CAACN,SAAS,CAAC;EAC/D,IAAMO,aAAa,GAAGJ,MAAM,CAACC,SAAS,CAACC,QAAQ,CAACC,IAAI,CAACL,SAAS,CAAC;EAE/D,IAAIC,aAAa,KAAKK,aAAa,IAAIA,aAAa,KAAK,iBAAiB,EAAE;IAC1E,IAAMC,IAAI,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,QAAQ,EAAE,OAAO,CAAC;IAC1C,KAAK,IAAIC,KAAK,GAAG,CAAC,EAAEA,KAAK,GAAGD,IAAI,CAACE,MAAM,EAAED,KAAK,EAAE,EAAE;MAChD,IAAME,GAAG,GAAGH,IAAI,CAACC,KAAK,CAAC;MACvB,IAAIT,SAAS,CAACW,GAAG,CAAC,KAAKV,SAAS,CAACU,GAAG,CAAC,EAAE;QACrC,OAAO,KAAK;;;IAIhB,OAAO,IAAI;;EAGb,OAAO,KAAK;AACd;;;;"}
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(t,e){var r=Object.prototype.toString.call(t),o=Object.prototype.toString.call(e);if(r===o&&"[object Object]"===o){for(var c=["x","y","height","width"],i=0;i<c.length;i++){var n=c[i];if(t[n]!==e[n])return!1}return!0}return!1};
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 const keys = ['x', 'y', 'height', 'width'];\n for (let index = 0; index < keys.length; index++) {\n const key = keys[index];\n if (oldLayout[key] !== newLayout[key]) {\n return false;\n }\n }\n\n return true;\n }\n\n return false;\n}\n"],"names":["oldLayout","newLayout","oldLayoutType","Object","prototype","toString","call","newLayoutType","keys","index","length","key"],"mappings":"6FAGEA,EACAC,GAEA,IAAMC,EAAgBC,OAAOC,UAAUC,SAASC,KAAKN,GAC/CO,EAAgBJ,OAAOC,UAAUC,SAASC,KAAKL,GAErD,GAAIC,IAAkBK,GAAmC,oBAAlBA,EAAqC,CAE1E,IADA,IAAMC,EAAO,CAAC,IAAK,IAAK,SAAU,SACzBC,EAAQ,EAAGA,EAAQD,EAAKE,OAAQD,IAAS,CAChD,IAAME,EAAMH,EAAKC,GACjB,GAAIT,EAAUW,KAASV,EAAUU,GAC/B,OAAO,EAIX,OAAO,EAGT,OAAO"}
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"}
@@ -1,10 +1,14 @@
1
- function layoutEqual(oldLayout, newLayout) {
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 keys = ['x', 'y', 'height', 'width'];
6
- for (var index = 0; index < keys.length; index++) {
7
- var key = keys[index];
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 const keys = ['x', 'y', 'height', 'width'];\n for (let index = 0; index < keys.length; index++) {\n const key = keys[index];\n if (oldLayout[key] !== newLayout[key]) {\n return false;\n }\n }\n\n return true;\n }\n\n return false;\n}\n"],"names":["layoutEqual","oldLayout","newLayout","oldLayoutType","Object","prototype","toString","call","newLayoutType","keys","index","length","key"],"mappings":"SAEwBA,WAAWA,CACjCC,SAAqB,EACrBC,SAAqB;EAErB,IAAMC,aAAa,GAAGC,MAAM,CAACC,SAAS,CAACC,QAAQ,CAACC,IAAI,CAACN,SAAS,CAAC;EAC/D,IAAMO,aAAa,GAAGJ,MAAM,CAACC,SAAS,CAACC,QAAQ,CAACC,IAAI,CAACL,SAAS,CAAC;EAE/D,IAAIC,aAAa,KAAKK,aAAa,IAAIA,aAAa,KAAK,iBAAiB,EAAE;IAC1E,IAAMC,IAAI,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,QAAQ,EAAE,OAAO,CAAC;IAC1C,KAAK,IAAIC,KAAK,GAAG,CAAC,EAAEA,KAAK,GAAGD,IAAI,CAACE,MAAM,EAAED,KAAK,EAAE,EAAE;MAChD,IAAME,GAAG,GAAGH,IAAI,CAACC,KAAK,CAAC;MACvB,IAAIT,SAAS,CAACW,GAAG,CAAC,KAAKV,SAAS,CAACU,GAAG,CAAC,EAAE;QACrC,OAAO,KAAK;;;IAIhB,OAAO,IAAI;;EAGb,OAAO,KAAK;AACd;;;;"}
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@x-oasis/layout-equal",
3
- "version": "0.1.11",
3
+ "version": "0.1.13",
4
4
  "description": "select value function",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
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
- const keys = ['x', 'y', 'height', 'width'];
12
- for (let index = 0; index < keys.length; index++) {
13
- const key = keys[index];
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
  }