@oliversalzburg/js-utils 0.0.30-dev.19 → 0.0.30-dev.20

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/format/bytes.d.ts CHANGED
@@ -3,7 +3,7 @@
3
3
  * It is available under the MIT license.
4
4
  */
5
5
  /**
6
- * Options for the `prettyBytes` function.
6
+ * Options for the `formatBytes` function.
7
7
  * @group Formatting
8
8
  */
9
9
  export interface FormatBytesOptions {
@@ -22,9 +22,9 @@ export interface FormatBytesOptions {
22
22
  * Format the number as [bits](https://en.wikipedia.org/wiki/Bit) instead of [bytes](https://en.wikipedia.org/wiki/Byte). This can be useful when, for example, referring to [bit rate](https://en.wikipedia.org/wiki/Bit_rate).
23
23
  * @example
24
24
  * ```
25
- * import prettyBytes from 'pretty-bytes';
25
+ * import formatBytes from '@oliversalzburg/js-utils/format/bytes.js';
26
26
  *
27
- * prettyBytes(1337, {bits: true});
27
+ * formatBytes(1337, {bits: true});
28
28
  * //=> '1.34 kbit'
29
29
  * ```
30
30
  */
@@ -33,12 +33,12 @@ export interface FormatBytesOptions {
33
33
  * Format the number using the [Binary Prefix](https://en.wikipedia.org/wiki/Binary_prefix) instead of the [SI Prefix](https://en.wikipedia.org/wiki/SI_prefix). This can be useful for presenting memory amounts. However, this should not be used for presenting file sizes.
34
34
  * @example
35
35
  * ```
36
- * import prettyBytes from 'pretty-bytes';
36
+ * import formatBytes from '@oliversalzburg/js-utils/format/bytes.js';
37
37
  *
38
- * prettyBytes(1000, {binary: true});
38
+ * formatBytes(1000, {binary: true});
39
39
  * //=> '1000 bit'
40
40
  *
41
- * prettyBytes(1024, {binary: true});
41
+ * formatBytes(1024, {binary: true});
42
42
  * //=> '1 kiB'
43
43
  * ```
44
44
  */
@@ -49,13 +49,13 @@ export interface FormatBytesOptions {
49
49
  * If neither `minimumFractionDigits` or `maximumFractionDigits` are set, the default behavior is to round to 3 significant digits.
50
50
  * @example
51
51
  * ```
52
- * import prettyBytes from 'pretty-bytes';
52
+ * import formatBytes from '@oliversalzburg/js-utils/format/bytes.js';
53
53
  *
54
54
  * // Show the number with at least 3 fractional digits
55
- * prettyBytes(1900, {minimumFractionDigits: 3});
55
+ * formatBytes(1900, {minimumFractionDigits: 3});
56
56
  * //=> '1.900 kB'
57
57
  *
58
- * prettyBytes(1900);
58
+ * formatBytes(1900);
59
59
  * //=> '1.9 kB'
60
60
  * ```
61
61
  */
@@ -66,13 +66,13 @@ export interface FormatBytesOptions {
66
66
  * If neither `minimumFractionDigits` or `maximumFractionDigits` are set, the default behavior is to round to 3 significant digits.
67
67
  * @example
68
68
  * ```
69
- * import prettyBytes from 'pretty-bytes';
69
+ * import formatBytes from '@oliversalzburg/js-utils/format/bytes.js';
70
70
  *
71
71
  * // Show the number with at most 1 fractional digit
72
- * prettyBytes(1920, {maximumFractionDigits: 1});
72
+ * formatBytes(1920, {maximumFractionDigits: 1});
73
73
  * //=> '1.9 kB'
74
74
  *
75
- * prettyBytes(1920);
75
+ * formatBytes(1920);
76
76
  * //=> '1.92 kB'
77
77
  * ```
78
78
  */
@@ -81,12 +81,12 @@ export interface FormatBytesOptions {
81
81
  * Put a space between the number and unit.
82
82
  * @example
83
83
  * ```
84
- * import prettyBytes from 'pretty-bytes';
84
+ * import formatBytes from '@oliversalzburg/js-utils/format/bytes.js';
85
85
  *
86
- * prettyBytes(1920, {space: false});
86
+ * formatBytes(1920, {space: false});
87
87
  * //=> '1.9kB'
88
88
  *
89
- * prettyBytes(1920);
89
+ * formatBytes(1920);
90
90
  * //=> '1.92 kB'
91
91
  * ```
92
92
  */
@@ -100,20 +100,20 @@ export interface FormatBytesOptions {
100
100
  * @group Formatting
101
101
  * @example
102
102
  * ```
103
- * import prettyBytes from '@oliversalzburg/js-utils/format/bytes.js';
103
+ * import formatBytes from '@oliversalzburg/js-utils/format/bytes.js';
104
104
  *
105
- * prettyBytes(1337);
105
+ * formatBytes(1337);
106
106
  * //=> '1.34 kB'
107
107
  *
108
- * prettyBytes(100);
108
+ * formatBytes(100);
109
109
  * //=> '100 B'
110
110
  *
111
111
  * // Display file size differences
112
- * prettyBytes(42, {signed: true});
112
+ * formatBytes(42, {signed: true});
113
113
  * //=> '+42 B'
114
114
  *
115
115
  * // Localized output using German locale
116
- * prettyBytes(1337, {locale: 'de'});
116
+ * formatBytes(1337, {locale: 'de'});
117
117
  * //=> '1,34 kB'
118
118
  * ```
119
119
  */
package/format/bytes.js CHANGED
@@ -34,20 +34,20 @@ const toLocaleString = (number, locale, options) => {
34
34
  * @group Formatting
35
35
  * @example
36
36
  * ```
37
- * import prettyBytes from '@oliversalzburg/js-utils/format/bytes.js';
37
+ * import formatBytes from '@oliversalzburg/js-utils/format/bytes.js';
38
38
  *
39
- * prettyBytes(1337);
39
+ * formatBytes(1337);
40
40
  * //=> '1.34 kB'
41
41
  *
42
- * prettyBytes(100);
42
+ * formatBytes(100);
43
43
  * //=> '100 B'
44
44
  *
45
45
  * // Display file size differences
46
- * prettyBytes(42, {signed: true});
46
+ * formatBytes(42, {signed: true});
47
47
  * //=> '+42 B'
48
48
  *
49
49
  * // Localized output using German locale
50
- * prettyBytes(1337, {locale: 'de'});
50
+ * formatBytes(1337, {locale: 'de'});
51
51
  * //=> '1,34 kB'
52
52
  * ```
53
53
  */
@@ -67,7 +67,7 @@ export interface FormatMillisecondsOptions {
67
67
  * @group Formatting
68
68
  * @example
69
69
  * ```
70
- * import formatMilliseconds from 'pretty-ms';
70
+ * import formatMilliseconds from '@oliversalzburg/js-utils/format/milliseconds.js';
71
71
  *
72
72
  * formatMilliseconds(1337000000);
73
73
  * //=> '15d 11h 23m 20s'
@@ -53,7 +53,7 @@ const ONE_DAY_IN_MILLISECONDS = 24n * 60n * 60n * 1000n;
53
53
  * @group Formatting
54
54
  * @example
55
55
  * ```
56
- * import formatMilliseconds from 'pretty-ms';
56
+ * import formatMilliseconds from '@oliversalzburg/js-utils/format/milliseconds.js';
57
57
  *
58
58
  * formatMilliseconds(1337000000);
59
59
  * //=> '15d 11h 23m 20s'
package/index.d.ts CHANGED
@@ -6,6 +6,7 @@ export * from "./dom/index.js";
6
6
  export * from "./error-serializer.js";
7
7
  export * from "./error/index.js";
8
8
  export * from "./event.js";
9
+ export * from "./format/index.js";
9
10
  export * from "./graphics/index.js";
10
11
  export * from "./log/index.js";
11
12
  export * from "./math/index.js";
package/index.js CHANGED
@@ -6,6 +6,7 @@ export * from "./dom/index.js";
6
6
  export * from "./error-serializer.js";
7
7
  export * from "./error/index.js";
8
8
  export * from "./event.js";
9
+ export * from "./format/index.js";
9
10
  export * from "./graphics/index.js";
10
11
  export * from "./log/index.js";
11
12
  export * from "./math/index.js";
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../source/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,UAAU,CAAC;AACzB,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../source/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,UAAU,CAAC;AACzB,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "@oliversalzburg/js-utils",
4
- "version": "0.0.30-dev.19",
4
+ "version": "0.0.30-dev.20",
5
5
  "license": "MIT",
6
6
  "author": "Oliver Salzburg <oliver.salzburg@gmail.com>",
7
7
  "repository": {