swcombine.js 0.0.6 → 0.0.7

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.cjs.js CHANGED
@@ -493,7 +493,7 @@ function findPrivilege(privileges, groupName, privilegeName) {
493
493
  return !!privilege && privilege.value === "true";
494
494
  }
495
495
  function mapSwcLocation(location) {
496
- var _a, _b, _c, _d;
496
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
497
497
  if (!location)
498
498
  return void 0;
499
499
  return {
@@ -507,19 +507,19 @@ function mapSwcLocation(location) {
507
507
  planet: !((_c = location.planet) == null ? void 0 : _c.value) ? void 0 : { uid: new SwcUid(location.planet.attributes.uid), name: location.planet.value },
508
508
  city: !((_d = location.city) == null ? void 0 : _d.value) ? void 0 : { uid: new SwcUid(location.city.attributes.uid), name: location.city.value },
509
509
  coordinates: {
510
- galaxy: { x: location.coordinates.galaxy.attributes.x, y: location.coordinates.galaxy.attributes.y },
511
- system: parseCoords(location.coordinates.system.attributes.x, location.coordinates.system.attributes.y),
512
- surface: parseCoords(location.coordinates.surface.attributes.x, location.coordinates.surface.attributes.y),
513
- ground: parseCoords(location.coordinates.ground.attributes.x, location.coordinates.ground.attributes.y)
510
+ galaxy: parseCoords((_e = location.coordinates.galaxy.attributes) == null ? void 0 : _e.x, (_f = location.coordinates.galaxy.attributes) == null ? void 0 : _f.y),
511
+ system: parseCoords((_g = location.coordinates.system.attributes) == null ? void 0 : _g.x, (_h = location.coordinates.system.attributes) == null ? void 0 : _h.y),
512
+ surface: parseCoords((_i = location.coordinates.surface.attributes) == null ? void 0 : _i.x, (_j = location.coordinates.surface.attributes) == null ? void 0 : _j.y),
513
+ ground: parseCoords((_k = location.coordinates.ground.attributes) == null ? void 0 : _k.x, (_l = location.coordinates.ground.attributes) == null ? void 0 : _l.y)
514
514
  }
515
515
  };
516
516
  }
517
517
  function parseCoords(x, y) {
518
- if (x === null || y === null)
518
+ if (x === null || x === void 0 || y === null || y === void 0)
519
519
  return { x: null, y: null };
520
- const intX = Number.parseInt(x, 10);
521
- const intY = Number.parseInt(y, 10);
522
- if (Number.isNaN(intX) || Number.isNaN(intY))
520
+ const intX = typeof x === "number" ? x : Number.parseInt(x, 10);
521
+ const intY = typeof y === "number" ? y : Number.parseInt(y, 10);
522
+ if (!Number.isFinite(intX) || !Number.isFinite(intY))
523
523
  return { x: null, y: null };
524
524
  return { x: intX, y: intY };
525
525
  }
package/dist/index.esm.js CHANGED
@@ -491,7 +491,7 @@ function findPrivilege(privileges, groupName, privilegeName) {
491
491
  return !!privilege && privilege.value === "true";
492
492
  }
493
493
  function mapSwcLocation(location) {
494
- var _a, _b, _c, _d;
494
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
495
495
  if (!location)
496
496
  return void 0;
497
497
  return {
@@ -505,19 +505,19 @@ function mapSwcLocation(location) {
505
505
  planet: !((_c = location.planet) == null ? void 0 : _c.value) ? void 0 : { uid: new SwcUid(location.planet.attributes.uid), name: location.planet.value },
506
506
  city: !((_d = location.city) == null ? void 0 : _d.value) ? void 0 : { uid: new SwcUid(location.city.attributes.uid), name: location.city.value },
507
507
  coordinates: {
508
- galaxy: { x: location.coordinates.galaxy.attributes.x, y: location.coordinates.galaxy.attributes.y },
509
- system: parseCoords(location.coordinates.system.attributes.x, location.coordinates.system.attributes.y),
510
- surface: parseCoords(location.coordinates.surface.attributes.x, location.coordinates.surface.attributes.y),
511
- ground: parseCoords(location.coordinates.ground.attributes.x, location.coordinates.ground.attributes.y)
508
+ galaxy: parseCoords((_e = location.coordinates.galaxy.attributes) == null ? void 0 : _e.x, (_f = location.coordinates.galaxy.attributes) == null ? void 0 : _f.y),
509
+ system: parseCoords((_g = location.coordinates.system.attributes) == null ? void 0 : _g.x, (_h = location.coordinates.system.attributes) == null ? void 0 : _h.y),
510
+ surface: parseCoords((_i = location.coordinates.surface.attributes) == null ? void 0 : _i.x, (_j = location.coordinates.surface.attributes) == null ? void 0 : _j.y),
511
+ ground: parseCoords((_k = location.coordinates.ground.attributes) == null ? void 0 : _k.x, (_l = location.coordinates.ground.attributes) == null ? void 0 : _l.y)
512
512
  }
513
513
  };
514
514
  }
515
515
  function parseCoords(x, y) {
516
- if (x === null || y === null)
516
+ if (x === null || x === void 0 || y === null || y === void 0)
517
517
  return { x: null, y: null };
518
- const intX = Number.parseInt(x, 10);
519
- const intY = Number.parseInt(y, 10);
520
- if (Number.isNaN(intX) || Number.isNaN(intY))
518
+ const intX = typeof x === "number" ? x : Number.parseInt(x, 10);
519
+ const intY = typeof y === "number" ? y : Number.parseInt(y, 10);
520
+ if (!Number.isFinite(intX) || !Number.isFinite(intY))
521
521
  return { x: null, y: null };
522
522
  return { x: intX, y: intY };
523
523
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "swcombine.js",
3
- "version": "0.0.6",
3
+ "version": "0.0.7",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "swcombine",