@trackunit/shared-utils 0.0.68-alpha-213b74a9d8d.0 → 0.0.69

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.
Files changed (3) hide show
  1. package/index.cjs.js +10 -39
  2. package/index.esm.js +10 -37
  3. package/package.json +4 -3
package/index.cjs.js CHANGED
@@ -1,7 +1,5 @@
1
1
  'use strict';
2
2
 
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
3
  exports.HoursAndMinutesFormat = void 0;
6
4
  (function (HoursAndMinutesFormat) {
7
5
  HoursAndMinutesFormat["HOURS_MIN_SEC_LONG"] = "HOURS_MIN_SEC_LONG";
@@ -650,7 +648,10 @@ const getFirstLevelObjectPropertyDifferences = (obj1, obj2) => {
650
648
  const val = obj2[key];
651
649
  // Check if obj1's property's value is different from obj2's.
652
650
  if (val !== value) {
653
- return Object.assign(Object.assign({}, diff), { [key]: val });
651
+ return {
652
+ ...diff,
653
+ [key]: val,
654
+ };
654
655
  }
655
656
  }
656
657
  // Otherwise, just return the previous diff object.
@@ -697,36 +698,6 @@ const trimIds = (str) => {
697
698
  return reducedPath;
698
699
  };
699
700
 
700
- /******************************************************************************
701
- Copyright (c) Microsoft Corporation.
702
-
703
- Permission to use, copy, modify, and/or distribute this software for any
704
- purpose with or without fee is hereby granted.
705
-
706
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
707
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
708
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
709
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
710
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
711
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
712
- PERFORMANCE OF THIS SOFTWARE.
713
- ***************************************************************************** */
714
-
715
- function __awaiter(thisArg, _arguments, P, generator) {
716
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
717
- return new (P || (P = Promise))(function (resolve, reject) {
718
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
719
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
720
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
721
- step((generator = generator.apply(thisArg, _arguments || [])).next());
722
- });
723
- }
724
-
725
- typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
726
- var e = new Error(message);
727
- return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
728
- };
729
-
730
701
  const dataURItoBlob = (dataURI) => {
731
702
  var _a, _b, _c, _d, _e;
732
703
  const bytes = ((_a = dataURI.split(",")[0]) !== null && _a !== void 0 ? _a : "").indexOf("base64") >= 0
@@ -749,13 +720,13 @@ const dataURItoBlob = (dataURI) => {
749
720
  * @returns {Promise<Blob>} A promise that resolves to the resized blob
750
721
  * @example resizeBlob(blob, 100, 100).then(resizedBlob => { ... })
751
722
  */
752
- const resizeBlob = (blob, newWidth, newHeight) => __awaiter(void 0, void 0, void 0, function* () {
723
+ const resizeBlob = async (blob, newWidth, newHeight) => {
753
724
  const url = window.URL.createObjectURL(blob);
754
- const image = yield loadSourceIntoImage(url);
725
+ const image = await loadSourceIntoImage(url);
755
726
  const resized = resizeImageElement(image, newWidth, newHeight);
756
727
  window.URL.revokeObjectURL(url);
757
728
  return resized;
758
- });
729
+ };
759
730
  /**
760
731
  * Resize width and height to be contained within the max parameters, while maintaining the aspect ratio
761
732
  */
@@ -816,13 +787,13 @@ const resizeImage = (settings) => {
816
787
  no(new Error("Not an image"));
817
788
  return;
818
789
  }
819
- reader.onload = (readerEvent) => __awaiter(void 0, void 0, void 0, function* () {
790
+ reader.onload = async (readerEvent) => {
820
791
  if (typeof readerEvent.target.result !== "string") {
821
792
  return;
822
793
  }
823
- const image = yield loadSourceIntoImage(readerEvent.target.result);
794
+ const image = await loadSourceIntoImage(readerEvent.target.result);
824
795
  ok(resizeImageElement(image, maxSize, maxSize));
825
- });
796
+ };
826
797
  reader.readAsDataURL(file);
827
798
  });
828
799
  };
package/index.esm.js CHANGED
@@ -646,7 +646,10 @@ const getFirstLevelObjectPropertyDifferences = (obj1, obj2) => {
646
646
  const val = obj2[key];
647
647
  // Check if obj1's property's value is different from obj2's.
648
648
  if (val !== value) {
649
- return Object.assign(Object.assign({}, diff), { [key]: val });
649
+ return {
650
+ ...diff,
651
+ [key]: val,
652
+ };
650
653
  }
651
654
  }
652
655
  // Otherwise, just return the previous diff object.
@@ -693,36 +696,6 @@ const trimIds = (str) => {
693
696
  return reducedPath;
694
697
  };
695
698
 
696
- /******************************************************************************
697
- Copyright (c) Microsoft Corporation.
698
-
699
- Permission to use, copy, modify, and/or distribute this software for any
700
- purpose with or without fee is hereby granted.
701
-
702
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
703
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
704
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
705
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
706
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
707
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
708
- PERFORMANCE OF THIS SOFTWARE.
709
- ***************************************************************************** */
710
-
711
- function __awaiter(thisArg, _arguments, P, generator) {
712
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
713
- return new (P || (P = Promise))(function (resolve, reject) {
714
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
715
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
716
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
717
- step((generator = generator.apply(thisArg, _arguments || [])).next());
718
- });
719
- }
720
-
721
- typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
722
- var e = new Error(message);
723
- return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
724
- };
725
-
726
699
  const dataURItoBlob = (dataURI) => {
727
700
  var _a, _b, _c, _d, _e;
728
701
  const bytes = ((_a = dataURI.split(",")[0]) !== null && _a !== void 0 ? _a : "").indexOf("base64") >= 0
@@ -745,13 +718,13 @@ const dataURItoBlob = (dataURI) => {
745
718
  * @returns {Promise<Blob>} A promise that resolves to the resized blob
746
719
  * @example resizeBlob(blob, 100, 100).then(resizedBlob => { ... })
747
720
  */
748
- const resizeBlob = (blob, newWidth, newHeight) => __awaiter(void 0, void 0, void 0, function* () {
721
+ const resizeBlob = async (blob, newWidth, newHeight) => {
749
722
  const url = window.URL.createObjectURL(blob);
750
- const image = yield loadSourceIntoImage(url);
723
+ const image = await loadSourceIntoImage(url);
751
724
  const resized = resizeImageElement(image, newWidth, newHeight);
752
725
  window.URL.revokeObjectURL(url);
753
726
  return resized;
754
- });
727
+ };
755
728
  /**
756
729
  * Resize width and height to be contained within the max parameters, while maintaining the aspect ratio
757
730
  */
@@ -812,13 +785,13 @@ const resizeImage = (settings) => {
812
785
  no(new Error("Not an image"));
813
786
  return;
814
787
  }
815
- reader.onload = (readerEvent) => __awaiter(void 0, void 0, void 0, function* () {
788
+ reader.onload = async (readerEvent) => {
816
789
  if (typeof readerEvent.target.result !== "string") {
817
790
  return;
818
791
  }
819
- const image = yield loadSourceIntoImage(readerEvent.target.result);
792
+ const image = await loadSourceIntoImage(readerEvent.target.result);
820
793
  ok(resizeImageElement(image, maxSize, maxSize));
821
- });
794
+ };
822
795
  reader.readAsDataURL(file);
823
796
  });
824
797
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/shared-utils",
3
- "version": "0.0.68-alpha-213b74a9d8d.0",
3
+ "version": "0.0.69",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "engines": {
@@ -8,5 +8,6 @@
8
8
  },
9
9
  "dependencies": {},
10
10
  "module": "./index.esm.js",
11
- "main": "./index.cjs.js"
12
- }
11
+ "main": "./index.cjs.js",
12
+ "types": "./index.esm.d.ts"
13
+ }