@powfix/core-js 0.28.2 → 0.29.0

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.
@@ -1,4 +1,12 @@
1
1
  'use strict';
2
+ function _array_like_to_array(arr, len) {
3
+ if (len == null || len > arr.length) len = arr.length;
4
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
5
+ return arr2;
6
+ }
7
+ function _array_with_holes(arr) {
8
+ if (Array.isArray(arr)) return arr;
9
+ }
2
10
  function _class_call_check(instance, Constructor) {
3
11
  if (!(instance instanceof Constructor)) {
4
12
  throw new TypeError("Cannot call a class as a function");
@@ -18,6 +26,48 @@ function _create_class(Constructor, protoProps, staticProps) {
18
26
  if (staticProps) _defineProperties(Constructor, staticProps);
19
27
  return Constructor;
20
28
  }
29
+ function _iterable_to_array_limit(arr, i) {
30
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
31
+ if (_i == null) return;
32
+ var _arr = [];
33
+ var _n = true;
34
+ var _d = false;
35
+ var _s, _e;
36
+ try {
37
+ for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
38
+ _arr.push(_s.value);
39
+ if (i && _arr.length === i) break;
40
+ }
41
+ } catch (err) {
42
+ _d = true;
43
+ _e = err;
44
+ } finally{
45
+ try {
46
+ if (!_n && _i["return"] != null) _i["return"]();
47
+ } finally{
48
+ if (_d) throw _e;
49
+ }
50
+ }
51
+ return _arr;
52
+ }
53
+ function _non_iterable_rest() {
54
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
55
+ }
56
+ function _sliced_to_array(arr, i) {
57
+ return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
58
+ }
59
+ function _type_of(obj) {
60
+ "@swc/helpers - typeof";
61
+ return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
62
+ }
63
+ function _unsupported_iterable_to_array(o, minLen) {
64
+ if (!o) return;
65
+ if (typeof o === "string") return _array_like_to_array(o, minLen);
66
+ var n = Object.prototype.toString.call(o).slice(8, -1);
67
+ if (n === "Object" && o.constructor) n = o.constructor.name;
68
+ if (n === "Map" || n === "Set") return Array.from(n);
69
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
70
+ }
21
71
  require('../../chunk-QHUNR4O5.cjs');
22
72
  var NumberUtils = /*#__PURE__*/ function() {
23
73
  function NumberUtils() {
@@ -31,6 +81,21 @@ var NumberUtils = /*#__PURE__*/ function() {
31
81
  return value.toString().replace(/\B(?=(\d{3})+(?!\d))/g, separator);
32
82
  }
33
83
  },
84
+ {
85
+ key: "formatThousands",
86
+ value: function formatThousands(value) {
87
+ var separator = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : ",";
88
+ if (typeof value !== "number") {
89
+ throw new TypeError("formatThousands: value must be a number. got ".concat(typeof value === "undefined" ? "undefined" : _type_of(value)));
90
+ }
91
+ if (!Number.isFinite(value)) {
92
+ throw new RangeError("formatThousands: value must be a finite number. got ".concat(value));
93
+ }
94
+ var _String_split = _sliced_to_array(String(value).split("."), 2), intPart = _String_split[0], fracPart = _String_split[1];
95
+ var formattedInt = intPart.replace(/\B(?=(\d{3})+(?!\d))/g, separator);
96
+ return fracPart != null ? "".concat(formattedInt, ".").concat(fracPart) : formattedInt;
97
+ }
98
+ },
34
99
  {
35
100
  key: "formatBigNumber",
36
101
  value: function formatBigNumber(value) {
@@ -1,4 +1,5 @@
1
1
  export declare class NumberUtils {
2
2
  static formatWithThousandsSeparator(value: number, separator?: string): string;
3
+ static formatThousands(value: number, separator?: string): string;
3
4
  static formatBigNumber(value: number, precision?: number): string;
4
5
  }
@@ -1,3 +1,11 @@
1
+ function _array_like_to_array(arr, len) {
2
+ if (len == null || len > arr.length) len = arr.length;
3
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
4
+ return arr2;
5
+ }
6
+ function _array_with_holes(arr) {
7
+ if (Array.isArray(arr)) return arr;
8
+ }
1
9
  function _class_call_check(instance, Constructor) {
2
10
  if (!(instance instanceof Constructor)) {
3
11
  throw new TypeError("Cannot call a class as a function");
@@ -17,6 +25,48 @@ function _create_class(Constructor, protoProps, staticProps) {
17
25
  if (staticProps) _defineProperties(Constructor, staticProps);
18
26
  return Constructor;
19
27
  }
28
+ function _iterable_to_array_limit(arr, i) {
29
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
30
+ if (_i == null) return;
31
+ var _arr = [];
32
+ var _n = true;
33
+ var _d = false;
34
+ var _s, _e;
35
+ try {
36
+ for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
37
+ _arr.push(_s.value);
38
+ if (i && _arr.length === i) break;
39
+ }
40
+ } catch (err) {
41
+ _d = true;
42
+ _e = err;
43
+ } finally{
44
+ try {
45
+ if (!_n && _i["return"] != null) _i["return"]();
46
+ } finally{
47
+ if (_d) throw _e;
48
+ }
49
+ }
50
+ return _arr;
51
+ }
52
+ function _non_iterable_rest() {
53
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
54
+ }
55
+ function _sliced_to_array(arr, i) {
56
+ return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
57
+ }
58
+ function _type_of(obj) {
59
+ "@swc/helpers - typeof";
60
+ return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
61
+ }
62
+ function _unsupported_iterable_to_array(o, minLen) {
63
+ if (!o) return;
64
+ if (typeof o === "string") return _array_like_to_array(o, minLen);
65
+ var n = Object.prototype.toString.call(o).slice(8, -1);
66
+ if (n === "Object" && o.constructor) n = o.constructor.name;
67
+ if (n === "Map" || n === "Set") return Array.from(n);
68
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
69
+ }
20
70
  import '../../chunk-S7EYY36U.js';
21
71
  var NumberUtils = /*#__PURE__*/ function() {
22
72
  "use strict";
@@ -31,6 +81,21 @@ var NumberUtils = /*#__PURE__*/ function() {
31
81
  return value.toString().replace(/\B(?=(\d{3})+(?!\d))/g, separator);
32
82
  }
33
83
  },
84
+ {
85
+ key: "formatThousands",
86
+ value: function formatThousands(value) {
87
+ var separator = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : ",";
88
+ if (typeof value !== "number") {
89
+ throw new TypeError("formatThousands: value must be a number. got ".concat(typeof value === "undefined" ? "undefined" : _type_of(value)));
90
+ }
91
+ if (!Number.isFinite(value)) {
92
+ throw new RangeError("formatThousands: value must be a finite number. got ".concat(value));
93
+ }
94
+ var _String_split = _sliced_to_array(String(value).split("."), 2), intPart = _String_split[0], fracPart = _String_split[1];
95
+ var formattedInt = intPart.replace(/\B(?=(\d{3})+(?!\d))/g, separator);
96
+ return fracPart != null ? "".concat(formattedInt, ".").concat(fracPart) : formattedInt;
97
+ }
98
+ },
34
99
  {
35
100
  key: "formatBigNumber",
36
101
  value: function formatBigNumber(value) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powfix/core-js",
3
- "version": "0.28.2",
3
+ "version": "0.29.0",
4
4
  "description": "core package",
5
5
  "author": "Kwon Kyung-Min <powfix@gmail.com>",
6
6
  "private": false,