@valkyriestudios/utils 12.3.0 → 12.5.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.
Files changed (159) hide show
  1. package/README.md +15 -4
  2. package/array/dedupe.d.ts +2 -1
  3. package/array/dedupe.js +3 -1
  4. package/array/index.d.ts +10 -0
  5. package/array/index.js +25 -0
  6. package/array/is.d.ts +2 -1
  7. package/array/is.js +2 -0
  8. package/array/isNotEmpty.d.ts +2 -1
  9. package/array/isNotEmpty.js +2 -0
  10. package/array/join.d.ts +2 -2
  11. package/array/join.js +3 -1
  12. package/array/mapFn.d.ts +4 -7
  13. package/array/mapFn.js +2 -0
  14. package/array/mapKey.d.ts +3 -4
  15. package/array/mapKey.js +2 -0
  16. package/array/mapPrimitive.d.ts +2 -2
  17. package/array/mapPrimitive.js +3 -1
  18. package/array/shuffle.d.ts +2 -1
  19. package/array/shuffle.js +2 -0
  20. package/array/sort.d.ts +2 -2
  21. package/array/sort.js +4 -2
  22. package/boolean/index.d.ts +2 -0
  23. package/boolean/index.js +6 -0
  24. package/boolean/is.d.ts +2 -1
  25. package/boolean/is.js +2 -0
  26. package/caching/index.d.ts +2 -0
  27. package/caching/index.js +5 -0
  28. package/caching/memoize.d.ts +2 -1
  29. package/caching/memoize.js +2 -0
  30. package/date/addUTC.d.ts +2 -1
  31. package/date/addUTC.js +3 -3
  32. package/date/diff.d.ts +2 -1
  33. package/date/diff.js +4 -2
  34. package/date/endOfUTC.d.ts +2 -1
  35. package/date/endOfUTC.js +3 -3
  36. package/date/format.d.ts +2 -1
  37. package/date/format.js +3 -1
  38. package/date/index.d.ts +11 -0
  39. package/date/index.js +24 -0
  40. package/date/is.d.ts +2 -1
  41. package/date/is.js +2 -0
  42. package/date/nowUnix.d.ts +2 -1
  43. package/date/nowUnix.js +2 -0
  44. package/date/nowUnixMs.d.ts +2 -1
  45. package/date/nowUnixMs.js +2 -0
  46. package/date/startOfUTC.d.ts +2 -1
  47. package/date/startOfUTC.js +3 -3
  48. package/date/toUTC.d.ts +2 -1
  49. package/date/toUTC.js +3 -1
  50. package/date/toUnix.d.ts +2 -1
  51. package/date/toUnix.js +3 -1
  52. package/deep/freeze.d.ts +2 -2
  53. package/deep/freeze.js +2 -0
  54. package/deep/get.d.ts +2 -1
  55. package/deep/get.js +2 -0
  56. package/deep/index.d.ts +5 -0
  57. package/deep/index.js +15 -0
  58. package/deep/seal.d.ts +2 -2
  59. package/deep/seal.js +2 -0
  60. package/deep/set.d.ts +2 -1
  61. package/deep/set.js +2 -0
  62. package/equal.d.ts +1 -1
  63. package/equal.js +4 -2
  64. package/formdata/index.d.ts +2 -0
  65. package/formdata/index.js +6 -0
  66. package/formdata/is.d.ts +9 -0
  67. package/formdata/is.js +8 -0
  68. package/function/index.d.ts +7 -0
  69. package/function/index.js +19 -0
  70. package/function/is.d.ts +2 -1
  71. package/function/is.js +2 -0
  72. package/function/isAsync.d.ts +2 -1
  73. package/function/isAsync.js +2 -0
  74. package/function/noop.d.ts +2 -1
  75. package/function/noop.js +2 -0
  76. package/function/noopresolve.d.ts +2 -1
  77. package/function/noopresolve.js +2 -0
  78. package/function/noopreturn.d.ts +2 -1
  79. package/function/noopreturn.js +2 -0
  80. package/function/sleep.d.ts +2 -1
  81. package/function/sleep.js +2 -0
  82. package/hash/fnv1A.d.ts +2 -1
  83. package/hash/fnv1A.js +2 -0
  84. package/hash/guid.d.ts +2 -1
  85. package/hash/guid.js +2 -0
  86. package/hash/index.d.ts +3 -0
  87. package/hash/index.js +7 -0
  88. package/index.d.ts +386 -238
  89. package/is.d.ts +52 -66
  90. package/is.js +61 -73
  91. package/number/index.d.ts +18 -0
  92. package/number/index.js +57 -0
  93. package/number/is.d.ts +2 -1
  94. package/number/is.js +2 -0
  95. package/number/isAbove.d.ts +2 -1
  96. package/number/isAbove.js +2 -0
  97. package/number/isAboveOrEqual.d.ts +2 -1
  98. package/number/isAboveOrEqual.js +2 -0
  99. package/number/isBelow.d.ts +2 -1
  100. package/number/isBelow.js +2 -0
  101. package/number/isBelowOrEqual.d.ts +2 -1
  102. package/number/isBelowOrEqual.js +2 -0
  103. package/number/isBetween.d.ts +2 -1
  104. package/number/isBetween.js +2 -0
  105. package/number/isInteger.d.ts +2 -1
  106. package/number/isInteger.js +2 -0
  107. package/number/isIntegerAbove.d.ts +2 -1
  108. package/number/isIntegerAbove.js +2 -0
  109. package/number/isIntegerAboveOrEqual.d.ts +2 -1
  110. package/number/isIntegerAboveOrEqual.js +2 -0
  111. package/number/isIntegerBelow.d.ts +2 -1
  112. package/number/isIntegerBelow.js +2 -0
  113. package/number/isIntegerBelowOrEqual.d.ts +2 -1
  114. package/number/isIntegerBelowOrEqual.js +2 -0
  115. package/number/isIntegerBetween.d.ts +2 -1
  116. package/number/isIntegerBetween.js +2 -0
  117. package/number/isNumericalNaN.d.ts +2 -1
  118. package/number/isNumericalNaN.js +2 -0
  119. package/number/randomBetween.d.ts +2 -1
  120. package/number/randomBetween.js +2 -0
  121. package/number/randomIntBetween.d.ts +2 -1
  122. package/number/randomIntBetween.js +2 -0
  123. package/number/round.d.ts +2 -1
  124. package/number/round.js +2 -0
  125. package/number/toPercentage.d.ts +2 -1
  126. package/number/toPercentage.js +3 -1
  127. package/object/define.d.ts +2 -1
  128. package/object/define.js +2 -0
  129. package/object/index.d.ts +6 -0
  130. package/object/index.js +17 -0
  131. package/object/is.d.ts +2 -1
  132. package/object/is.js +2 -0
  133. package/object/isNotEmpty.d.ts +2 -1
  134. package/object/isNotEmpty.js +2 -0
  135. package/object/merge.d.ts +1 -1
  136. package/object/merge.js +2 -0
  137. package/object/pick.d.ts +2 -1
  138. package/object/pick.js +4 -2
  139. package/package.json +1 -1
  140. package/regexp/index.d.ts +3 -0
  141. package/regexp/index.js +9 -0
  142. package/regexp/is.d.ts +2 -1
  143. package/regexp/is.js +2 -0
  144. package/regexp/sanitize.d.ts +2 -1
  145. package/regexp/sanitize.js +2 -0
  146. package/string/humanizeBytes.d.ts +2 -2
  147. package/string/humanizeBytes.js +4 -3
  148. package/string/humanizeNumber.d.ts +2 -2
  149. package/string/humanizeNumber.js +3 -1
  150. package/string/index.d.ts +7 -0
  151. package/string/index.js +20 -0
  152. package/string/is.d.ts +2 -1
  153. package/string/is.js +2 -0
  154. package/string/isBetween.d.ts +2 -1
  155. package/string/isBetween.js +2 -0
  156. package/string/isNotEmpty.d.ts +2 -1
  157. package/string/isNotEmpty.js +2 -0
  158. package/string/shorten.d.ts +2 -1
  159. package/string/shorten.js +2 -0
@@ -1,9 +1,11 @@
1
1
  'use strict';
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = exports.randomIntBetween = void 0;
3
4
  function randomIntBetween(min = 0, max = 10) {
4
5
  if (!Number.isFinite(min) ||
5
6
  !Number.isFinite(max))
6
7
  throw new TypeError('Min/Max should be numeric');
7
8
  return Math.floor((Math.random() * (max - min)) + min);
8
9
  }
10
+ exports.randomIntBetween = randomIntBetween;
9
11
  exports.default = randomIntBetween;
package/number/round.d.ts CHANGED
@@ -6,4 +6,5 @@
6
6
  *
7
7
  * @returns Rounded value according to decimal precision provided
8
8
  */
9
- export default function round(val: number, precision?: number): number;
9
+ declare function round(val: number, precision?: number): number;
10
+ export { round, round as default };
package/number/round.js CHANGED
@@ -1,5 +1,6 @@
1
1
  'use strict';
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = exports.round = void 0;
3
4
  function round(val, precision = 0) {
4
5
  if (!Number.isFinite(val))
5
6
  throw new TypeError('Value should be numeric');
@@ -7,4 +8,5 @@ function round(val, precision = 0) {
7
8
  const num = (val * exp) * (1 + Number.EPSILON);
8
9
  return Math.round(num) / exp;
9
10
  }
11
+ exports.round = round;
10
12
  exports.default = round;
@@ -8,4 +8,5 @@
8
8
  *
9
9
  * @returns Percentage value respective to the provided range
10
10
  */
11
- export default function toPercentage(val: number, precision?: number, min?: number, max?: number): number;
11
+ declare function toPercentage(val: number, precision?: number, min?: number, max?: number): number;
12
+ export { toPercentage, toPercentage as default };
@@ -1,11 +1,13 @@
1
1
  'use strict';
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = exports.toPercentage = void 0;
3
4
  const round_1 = require("./round");
4
5
  function toPercentage(val, precision = 0, min = 0, max = 1) {
5
6
  if (!Number.isFinite(val) ||
6
7
  !Number.isFinite(min) ||
7
8
  !Number.isFinite(max))
8
9
  throw new TypeError('value/min/max should be numeric');
9
- return (0, round_1.default)(((val - min) / (max - min)) * 100, precision);
10
+ return (0, round_1.round)(((val - min) / (max - min)) * 100, precision);
10
11
  }
12
+ exports.toPercentage = toPercentage;
11
13
  exports.default = toPercentage;
@@ -6,10 +6,11 @@
6
6
  *
7
7
  * @returns Object with the defined properties
8
8
  */
9
- export default function define(props: {
9
+ declare function define(props: {
10
10
  [key: string]: any;
11
11
  }, obj?: {
12
12
  [key: string]: any;
13
13
  }): {
14
14
  [key: string]: any;
15
15
  };
16
+ export { define, define as default };
package/object/define.js CHANGED
@@ -1,9 +1,11 @@
1
1
  'use strict';
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = exports.define = void 0;
3
4
  function define(props, obj = {}) {
4
5
  if (Object.prototype.toString.call(props) !== '[object Object]' ||
5
6
  Object.prototype.toString.call(obj) !== '[object Object]')
6
7
  throw new TypeError('Please pass an object as the value for props and obj');
7
8
  return Object.defineProperties(obj, props);
8
9
  }
10
+ exports.define = define;
9
11
  exports.default = define;
@@ -0,0 +1,6 @@
1
+ import { define } from './define';
2
+ import { isObject } from './is';
3
+ import { isNotEmptyObject } from './isNotEmpty';
4
+ import { merge } from './merge';
5
+ import { pick } from './pick';
6
+ export { define, isObject, isObject as is, isNotEmptyObject, isNotEmptyObject as isNotEmpty, isNotEmptyObject as isNeObject, isNotEmptyObject as isNe, merge, pick };
@@ -0,0 +1,17 @@
1
+ 'use strict';
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.pick = exports.merge = exports.isNe = exports.isNeObject = exports.isNotEmpty = exports.isNotEmptyObject = exports.is = exports.isObject = exports.define = void 0;
4
+ const define_1 = require("./define");
5
+ Object.defineProperty(exports, "define", { enumerable: true, get: function () { return define_1.define; } });
6
+ const is_1 = require("./is");
7
+ Object.defineProperty(exports, "isObject", { enumerable: true, get: function () { return is_1.isObject; } });
8
+ Object.defineProperty(exports, "is", { enumerable: true, get: function () { return is_1.isObject; } });
9
+ const isNotEmpty_1 = require("./isNotEmpty");
10
+ Object.defineProperty(exports, "isNotEmptyObject", { enumerable: true, get: function () { return isNotEmpty_1.isNotEmptyObject; } });
11
+ Object.defineProperty(exports, "isNotEmpty", { enumerable: true, get: function () { return isNotEmpty_1.isNotEmptyObject; } });
12
+ Object.defineProperty(exports, "isNeObject", { enumerable: true, get: function () { return isNotEmpty_1.isNotEmptyObject; } });
13
+ Object.defineProperty(exports, "isNe", { enumerable: true, get: function () { return isNotEmpty_1.isNotEmptyObject; } });
14
+ const merge_1 = require("./merge");
15
+ Object.defineProperty(exports, "merge", { enumerable: true, get: function () { return merge_1.merge; } });
16
+ const pick_1 = require("./pick");
17
+ Object.defineProperty(exports, "pick", { enumerable: true, get: function () { return pick_1.pick; } });
package/object/is.d.ts CHANGED
@@ -5,6 +5,7 @@
5
5
  *
6
6
  * @returns Whether or not the value is an object
7
7
  */
8
- export default function isObject(val: unknown): val is {
8
+ declare function isObject(val: unknown): val is {
9
9
  [key: string]: any;
10
10
  };
11
+ export { isObject, isObject as default };
package/object/is.js CHANGED
@@ -1,7 +1,9 @@
1
1
  'use strict';
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = exports.isObject = void 0;
3
4
  const PROTO_OBJ = '[object Object]';
4
5
  function isObject(val) {
5
6
  return Object.prototype.toString.call(val) === PROTO_OBJ;
6
7
  }
8
+ exports.isObject = isObject;
7
9
  exports.default = isObject;
@@ -5,6 +5,7 @@
5
5
  *
6
6
  * @returns Whether or not the value is an object with content
7
7
  */
8
- export default function isNotEmptyObject(val: unknown): val is {
8
+ declare function isNotEmptyObject(val: unknown): val is {
9
9
  [key: string]: any;
10
10
  };
11
+ export { isNotEmptyObject, isNotEmptyObject as default };
@@ -1,6 +1,8 @@
1
1
  'use strict';
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = exports.isNotEmptyObject = void 0;
3
4
  function isNotEmptyObject(val) {
4
5
  return Object.prototype.toString.call(val) === '[object Object]' && Object.keys(val).length > 0;
5
6
  }
7
+ exports.isNotEmptyObject = isNotEmptyObject;
6
8
  exports.default = isNotEmptyObject;
package/object/merge.d.ts CHANGED
@@ -15,4 +15,4 @@ declare function merge(target: {
15
15
  }): {
16
16
  [key: string]: any;
17
17
  };
18
- export default merge;
18
+ export { merge, merge as default };
package/object/merge.js CHANGED
@@ -1,5 +1,6 @@
1
1
  'use strict';
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = exports.merge = void 0;
3
4
  const PROTO_OBJ = '[object Object]';
4
5
  function merge(target, source = {}) {
5
6
  if (Object.prototype.toString.call(target) !== PROTO_OBJ ||
@@ -19,4 +20,5 @@ function merge(target, source = {}) {
19
20
  }
20
21
  return acc;
21
22
  }
23
+ exports.merge = merge;
22
24
  exports.default = merge;
package/object/pick.d.ts CHANGED
@@ -6,8 +6,9 @@
6
6
  *
7
7
  * @returns Object containing the picked keys from source object
8
8
  */
9
- export default function pick(obj: {
9
+ declare function pick(obj: {
10
10
  [key: string]: any;
11
11
  }, keys: string[]): {
12
12
  [key: string]: any;
13
13
  };
14
+ export { pick, pick as default };
package/object/pick.js CHANGED
@@ -1,5 +1,6 @@
1
1
  'use strict';
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = exports.pick = void 0;
3
4
  const get_1 = require("../deep/get");
4
5
  const set_1 = require("../deep/set");
5
6
  const RGX_DEEP = /(\.|\[)/;
@@ -18,10 +19,10 @@ function pick(obj, keys) {
18
19
  if (!sanitized.length)
19
20
  continue;
20
21
  if (RGX_DEEP.test(sanitized)) {
21
- val = (0, get_1.default)(obj, sanitized);
22
+ val = (0, get_1.deepGet)(obj, sanitized);
22
23
  if (val === undefined)
23
24
  continue;
24
- (0, set_1.default)(map, sanitized, val);
25
+ (0, set_1.deepSet)(map, sanitized, val);
25
26
  }
26
27
  else if (obj[sanitized] !== undefined) {
27
28
  map[sanitized] = obj[sanitized];
@@ -29,4 +30,5 @@ function pick(obj, keys) {
29
30
  }
30
31
  return map;
31
32
  }
33
+ exports.pick = pick;
32
34
  exports.default = pick;
package/package.json CHANGED
@@ -1 +1 @@
1
- { "name": "@valkyriestudios/utils", "version": "12.3.0", "description": "A collection of single-function utilities for common tasks", "author": { "name": "Peter Vermeulen", "email": "contact@valkyriestudios.be", "url": "www.valkyriestudios.be" }, "keywords": [ "utility", "library", "javascript", "js", "node", "bun" ], "license": "MIT", "repository": { "type": "git", "url": "git+https://github.com/ValkyrieStudios/utils.git" }, "bugs": { "url": "https://github.com/ValkyrieStudios/utils/issues" }, "homepage": "https://github.com/ValkyrieStudios/utils#readme", "types": "index.d.ts" }
1
+ { "name": "@valkyriestudios/utils", "version": "12.5.0", "description": "A collection of single-function utilities for common tasks", "author": { "name": "Peter Vermeulen", "url": "https://www.linkedin.com/in/petervermeulen1/" }, "keywords": [ "utility", "library", "javascript", "js", "node", "bun" ], "license": "MIT", "repository": { "type": "git", "url": "git+https://github.com/ValkyrieStudios/utils.git" }, "bugs": { "url": "https://github.com/ValkyrieStudios/utils/issues" }, "homepage": "https://github.com/ValkyrieStudios/utils#readme", "types": "index.d.ts" }
@@ -0,0 +1,3 @@
1
+ import { isRegExp } from './is';
2
+ import { sanitizeRegExp } from './sanitize';
3
+ export { isRegExp, isRegExp as is, sanitizeRegExp, sanitizeRegExp as sanitize };
@@ -0,0 +1,9 @@
1
+ 'use strict';
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.sanitize = exports.sanitizeRegExp = exports.is = exports.isRegExp = void 0;
4
+ const is_1 = require("./is");
5
+ Object.defineProperty(exports, "isRegExp", { enumerable: true, get: function () { return is_1.isRegExp; } });
6
+ Object.defineProperty(exports, "is", { enumerable: true, get: function () { return is_1.isRegExp; } });
7
+ const sanitize_1 = require("./sanitize");
8
+ Object.defineProperty(exports, "sanitizeRegExp", { enumerable: true, get: function () { return sanitize_1.sanitizeRegExp; } });
9
+ Object.defineProperty(exports, "sanitize", { enumerable: true, get: function () { return sanitize_1.sanitizeRegExp; } });
package/regexp/is.d.ts CHANGED
@@ -5,4 +5,5 @@
5
5
  *
6
6
  * @returns Whether or not the value is a RegExp
7
7
  */
8
- export default function isRegExp(val: unknown): val is RegExp;
8
+ declare function isRegExp(val: unknown): val is RegExp;
9
+ export { isRegExp, isRegExp as default };
package/regexp/is.js CHANGED
@@ -1,6 +1,8 @@
1
1
  'use strict';
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = exports.isRegExp = void 0;
3
4
  function isRegExp(val) {
4
5
  return val instanceof RegExp;
5
6
  }
7
+ exports.isRegExp = isRegExp;
6
8
  exports.default = isRegExp;
@@ -8,4 +8,5 @@
8
8
  *
9
9
  * @returns Sanitized value
10
10
  */
11
- export default function sanitizeRegExp(val: string): string | false;
11
+ declare function sanitizeRegExp(val: string): string | false;
12
+ export { sanitizeRegExp, sanitizeRegExp as default };
@@ -1,8 +1,10 @@
1
1
  'use strict';
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = exports.sanitizeRegExp = void 0;
3
4
  function sanitizeRegExp(val) {
4
5
  if (typeof val !== 'string')
5
6
  return false;
6
7
  return val.trim().replace(/[.*+\-?^${}()|[\]\\]/g, '\\$&');
7
8
  }
9
+ exports.sanitizeRegExp = sanitizeRegExp;
8
10
  exports.default = sanitizeRegExp;
@@ -36,5 +36,5 @@ interface humanizeBytesOptions {
36
36
  *
37
37
  * @returns Humanized byte value as string
38
38
  */
39
- export default function humanizeBytes(val: number | string, options?: humanizeBytesOptions): string;
40
- export {};
39
+ declare function humanizeBytes(val: number | string, options?: humanizeBytesOptions): string;
40
+ export { humanizeBytes, humanizeBytes as default };
@@ -1,10 +1,10 @@
1
1
  'use strict';
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = exports.humanizeBytes = void 0;
3
4
  const humanizeNumber_1 = require("./humanizeNumber");
4
- const isNotEmpty_1 = require("../string/isNotEmpty");
5
5
  function humanizeBytes(val, options = {}) {
6
6
  const has_opts = Object.prototype.toString.call(options) === '[object Object]';
7
- return (0, humanizeNumber_1.default)(val, {
7
+ return (0, humanizeNumber_1.humanizeNumber)(val, {
8
8
  delim: has_opts && typeof options.delim === 'string'
9
9
  ? options.delim
10
10
  : ',',
@@ -15,10 +15,11 @@ function humanizeBytes(val, options = {}) {
15
15
  ? options.precision
16
16
  : 2,
17
17
  units: has_opts && Array.isArray(options.units) && options.units.length
18
- ? options.units.filter(el => (0, isNotEmpty_1.default)(el))
18
+ ? options.units
19
19
  : [' bytes', ' KB', ' MB', ' GB', ' TB', ' PB', ' EB', ' ZB', ' YB'],
20
20
  divider: 1024,
21
21
  real: true,
22
22
  });
23
23
  }
24
+ exports.humanizeBytes = humanizeBytes;
24
25
  exports.default = humanizeBytes;
@@ -48,5 +48,5 @@ interface humanizeNumberOptions {
48
48
  *
49
49
  * @returns Humanized number as string
50
50
  */
51
- export default function humanizeNumber(val: number | string, options?: humanizeNumberOptions | false): string;
52
- export {};
51
+ declare function humanizeNumber(val: number | string, options?: humanizeNumberOptions | false): string;
52
+ export { humanizeNumber, humanizeNumber as default };
@@ -1,5 +1,6 @@
1
1
  'use strict';
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = exports.humanizeNumber = void 0;
3
4
  const round_1 = require("../number/round");
4
5
  const DEFAULT_UNITS = ['', 'k', 'm', 'b', 't', 'q'];
5
6
  function humanizeNumber(val, options = false) {
@@ -45,7 +46,7 @@ function humanizeNumber(val, options = false) {
45
46
  normalized /= DIVIDER;
46
47
  }
47
48
  }
48
- const humanized = `${(0, round_1.default)(normalized, PRECISION)}`.split('.', 2);
49
+ const humanized = `${(0, round_1.round)(normalized, PRECISION)}`.split('.', 2);
49
50
  humanized[0] = humanized[0].split('').reverse().map((char, ix, original) => {
50
51
  if (ix > 0 && ix < original.length && ix % 3 === 0)
51
52
  return char + DELIM;
@@ -53,4 +54,5 @@ function humanizeNumber(val, options = false) {
53
54
  }).reverse().join('');
54
55
  return `${sign}${humanized.join(SEPARATOR)}${UNITS ? UNITS[unit_ix] : ''}`;
55
56
  }
57
+ exports.humanizeNumber = humanizeNumber;
56
58
  exports.default = humanizeNumber;
@@ -0,0 +1,7 @@
1
+ import { humanizeBytes } from './humanizeBytes';
2
+ import { humanizeNumber } from './humanizeNumber';
3
+ import { isString } from './is';
4
+ import { isNotEmptyString } from './isNotEmpty';
5
+ import { isStringBetween } from './isBetween';
6
+ import { shorten } from './shorten';
7
+ export { humanizeBytes, humanizeNumber, isString, isString as is, isNotEmptyString, isNotEmptyString as isNotEmpty, isNotEmptyString as isNeString, isNotEmptyString as isNe, isStringBetween, isStringBetween as isBetween, shorten };
@@ -0,0 +1,20 @@
1
+ 'use strict';
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.shorten = exports.isBetween = exports.isStringBetween = exports.isNe = exports.isNeString = exports.isNotEmpty = exports.isNotEmptyString = exports.is = exports.isString = exports.humanizeNumber = exports.humanizeBytes = void 0;
4
+ const humanizeBytes_1 = require("./humanizeBytes");
5
+ Object.defineProperty(exports, "humanizeBytes", { enumerable: true, get: function () { return humanizeBytes_1.humanizeBytes; } });
6
+ const humanizeNumber_1 = require("./humanizeNumber");
7
+ Object.defineProperty(exports, "humanizeNumber", { enumerable: true, get: function () { return humanizeNumber_1.humanizeNumber; } });
8
+ const is_1 = require("./is");
9
+ Object.defineProperty(exports, "isString", { enumerable: true, get: function () { return is_1.isString; } });
10
+ Object.defineProperty(exports, "is", { enumerable: true, get: function () { return is_1.isString; } });
11
+ const isNotEmpty_1 = require("./isNotEmpty");
12
+ Object.defineProperty(exports, "isNotEmptyString", { enumerable: true, get: function () { return isNotEmpty_1.isNotEmptyString; } });
13
+ Object.defineProperty(exports, "isNotEmpty", { enumerable: true, get: function () { return isNotEmpty_1.isNotEmptyString; } });
14
+ Object.defineProperty(exports, "isNeString", { enumerable: true, get: function () { return isNotEmpty_1.isNotEmptyString; } });
15
+ Object.defineProperty(exports, "isNe", { enumerable: true, get: function () { return isNotEmpty_1.isNotEmptyString; } });
16
+ const isBetween_1 = require("./isBetween");
17
+ Object.defineProperty(exports, "isStringBetween", { enumerable: true, get: function () { return isBetween_1.isStringBetween; } });
18
+ Object.defineProperty(exports, "isBetween", { enumerable: true, get: function () { return isBetween_1.isStringBetween; } });
19
+ const shorten_1 = require("./shorten");
20
+ Object.defineProperty(exports, "shorten", { enumerable: true, get: function () { return shorten_1.shorten; } });
package/string/is.d.ts CHANGED
@@ -5,4 +5,5 @@
5
5
  *
6
6
  * @returns Whether or not the value is a string
7
7
  */
8
- export default function isString(val: unknown): val is string;
8
+ declare function isString(val: unknown): val is string;
9
+ export { isString, isString as default };
package/string/is.js CHANGED
@@ -1,6 +1,8 @@
1
1
  'use strict';
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = exports.isString = void 0;
3
4
  function isString(val) {
4
5
  return typeof val === 'string';
5
6
  }
7
+ exports.isString = isString;
6
8
  exports.default = isString;
@@ -10,4 +10,5 @@
10
10
  *
11
11
  * @returns Whether or not the value is a string of length between min and max inclusive
12
12
  */
13
- export default function isStringBetween(val: unknown, min: number, max: number, trimmed?: boolean): val is string;
13
+ declare function isStringBetween(val: unknown, min: number, max: number, trimmed?: boolean): val is string;
14
+ export { isStringBetween, isStringBetween as default };
@@ -1,5 +1,6 @@
1
1
  'use strict';
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = exports.isStringBetween = void 0;
3
4
  function isStringBetween(val, min, max, trimmed = true) {
4
5
  if (typeof val !== 'string' ||
5
6
  !Number.isFinite(min) ||
@@ -11,4 +12,5 @@ function isStringBetween(val, min, max, trimmed = true) {
11
12
  const length = (trimmed === true ? val.trim() : val).length;
12
13
  return length >= min && length <= max;
13
14
  }
15
+ exports.isStringBetween = isStringBetween;
14
16
  exports.default = isStringBetween;
@@ -6,4 +6,5 @@
6
6
  *
7
7
  * @returns Whether or not the value is a string with content
8
8
  */
9
- export default function isNotEmptyString(val: unknown, trimmed?: boolean): val is string;
9
+ declare function isNotEmptyString(val: unknown, trimmed?: boolean): val is string;
10
+ export { isNotEmptyString, isNotEmptyString as default };
@@ -1,8 +1,10 @@
1
1
  'use strict';
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = exports.isNotEmptyString = void 0;
3
4
  function isNotEmptyString(val, trimmed = true) {
4
5
  if (typeof val !== 'string')
5
6
  return false;
6
7
  return (trimmed === true ? val.trim() : val).length > 0;
7
8
  }
9
+ exports.isNotEmptyString = isNotEmptyString;
8
10
  exports.default = isNotEmptyString;
@@ -7,4 +7,5 @@
7
7
  *
8
8
  * @returns Shortened string
9
9
  */
10
- export default function shorten(val: string, length: number, postfix?: string): string;
10
+ declare function shorten(val: string, length: number, postfix?: string): string;
11
+ export { shorten, shorten as default };
package/string/shorten.js CHANGED
@@ -1,5 +1,6 @@
1
1
  'use strict';
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = exports.shorten = void 0;
3
4
  function shorten(val, length, postfix = '...') {
4
5
  if (typeof val !== 'string')
5
6
  return '';
@@ -8,4 +9,5 @@ function shorten(val, length, postfix = '...') {
8
9
  const sanitized = val.trim();
9
10
  return sanitized.length <= length ? sanitized : `${sanitized.substring(0, length)}${postfix}`;
10
11
  }
12
+ exports.shorten = shorten;
11
13
  exports.default = shorten;