@onivoro/isomorphic-common 0.4.2 → 22.0.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 (82) hide show
  1. package/dist/cjs/index.d.ts +3 -0
  2. package/dist/cjs/index.js +3 -0
  3. package/dist/cjs/lib/constants/decimal-regex.constant.d.ts +1 -0
  4. package/dist/cjs/lib/constants/decimal-regex.constant.js +4 -0
  5. package/dist/cjs/lib/functions/add-offset.function.js +1 -2
  6. package/dist/cjs/lib/functions/convert-object-to-literal.function.js +1 -2
  7. package/dist/cjs/lib/functions/from-boolean-string.function.d.ts +1 -1
  8. package/dist/cjs/lib/functions/from-boolean-string.function.js +1 -2
  9. package/dist/cjs/lib/functions/from-calendar-date.function.js +1 -2
  10. package/dist/cjs/lib/functions/from-csv-string.function.js +1 -2
  11. package/dist/cjs/lib/functions/get-tag.function.js +1 -2
  12. package/dist/cjs/lib/functions/is-symbol.function.js +1 -2
  13. package/dist/cjs/lib/functions/kebab-case.function.js +1 -2
  14. package/dist/cjs/lib/functions/money.function.d.ts +1 -0
  15. package/dist/cjs/lib/functions/money.function.js +19 -0
  16. package/dist/cjs/lib/functions/parse-bool.function.js +1 -2
  17. package/dist/cjs/lib/functions/properties-to-array.function.js +1 -2
  18. package/dist/cjs/lib/functions/remove-alpha-chars.function.d.ts +1 -0
  19. package/dist/cjs/lib/functions/remove-alpha-chars.function.js +10 -0
  20. package/dist/cjs/lib/functions/sanitize-filename.function.js +1 -2
  21. package/dist/cjs/lib/functions/sleep.function.js +1 -2
  22. package/dist/cjs/lib/functions/snake-case.function.js +1 -2
  23. package/dist/cjs/lib/functions/subtract-offset.function.js +1 -2
  24. package/dist/cjs/lib/functions/to-boolean-string.function.js +1 -2
  25. package/dist/cjs/lib/functions/to-calendar-date.function.js +1 -2
  26. package/dist/cjs/lib/functions/to-csv-string.function.js +1 -2
  27. package/dist/cjs/lib/functions/to-decimal-base.function.js +1 -2
  28. package/dist/cjs/lib/functions/to-dollars-and-cents.function.d.ts +1 -1
  29. package/dist/cjs/lib/functions/to-dollars-and-cents.function.js +4 -3
  30. package/dist/cjs/lib/functions/to-string.function.js +1 -2
  31. package/dist/cjs/lib/functions/to-unique-array.function.js +1 -2
  32. package/dist/cjs/lib/functions/to-words.function.d.ts +1 -1
  33. package/dist/cjs/lib/functions/to-words.function.js +4 -3
  34. package/dist/cjs/lib/functions/try-parse-date.function.js +1 -2
  35. package/dist/cjs/lib/functions/unicode-words.const.js +1 -2
  36. package/dist/cjs/lib/functions/upper-first.function.js +1 -2
  37. package/dist/cjs/lib/functions/words.function.js +1 -2
  38. package/dist/esm/index.d.ts +3 -0
  39. package/dist/esm/index.js +3 -0
  40. package/dist/esm/lib/constants/decimal-regex.constant.d.ts +1 -0
  41. package/dist/esm/lib/constants/decimal-regex.constant.js +4 -0
  42. package/dist/esm/lib/functions/add-offset.function.js +1 -2
  43. package/dist/esm/lib/functions/convert-object-to-literal.function.js +1 -2
  44. package/dist/esm/lib/functions/from-boolean-string.function.d.ts +1 -1
  45. package/dist/esm/lib/functions/from-boolean-string.function.js +1 -2
  46. package/dist/esm/lib/functions/from-calendar-date.function.js +1 -2
  47. package/dist/esm/lib/functions/from-csv-string.function.js +1 -2
  48. package/dist/esm/lib/functions/get-tag.function.js +1 -2
  49. package/dist/esm/lib/functions/is-symbol.function.js +1 -2
  50. package/dist/esm/lib/functions/kebab-case.function.js +1 -2
  51. package/dist/esm/lib/functions/money.function.d.ts +1 -0
  52. package/dist/esm/lib/functions/money.function.js +19 -0
  53. package/dist/esm/lib/functions/parse-bool.function.js +1 -2
  54. package/dist/esm/lib/functions/properties-to-array.function.js +1 -2
  55. package/dist/esm/lib/functions/remove-alpha-chars.function.d.ts +1 -0
  56. package/dist/esm/lib/functions/remove-alpha-chars.function.js +10 -0
  57. package/dist/esm/lib/functions/sanitize-filename.function.js +1 -2
  58. package/dist/esm/lib/functions/sleep.function.js +1 -2
  59. package/dist/esm/lib/functions/snake-case.function.js +1 -2
  60. package/dist/esm/lib/functions/subtract-offset.function.js +1 -2
  61. package/dist/esm/lib/functions/to-boolean-string.function.js +1 -2
  62. package/dist/esm/lib/functions/to-calendar-date.function.js +1 -2
  63. package/dist/esm/lib/functions/to-csv-string.function.js +1 -2
  64. package/dist/esm/lib/functions/to-decimal-base.function.js +1 -2
  65. package/dist/esm/lib/functions/to-dollars-and-cents.function.d.ts +1 -1
  66. package/dist/esm/lib/functions/to-dollars-and-cents.function.js +4 -3
  67. package/dist/esm/lib/functions/to-string.function.js +1 -2
  68. package/dist/esm/lib/functions/to-unique-array.function.js +1 -2
  69. package/dist/esm/lib/functions/to-words.function.d.ts +1 -1
  70. package/dist/esm/lib/functions/to-words.function.js +4 -3
  71. package/dist/esm/lib/functions/try-parse-date.function.js +1 -2
  72. package/dist/esm/lib/functions/unicode-words.const.js +1 -2
  73. package/dist/esm/lib/functions/upper-first.function.js +1 -2
  74. package/dist/esm/lib/functions/words.function.js +1 -2
  75. package/dist/types/index.d.ts +3 -0
  76. package/dist/types/lib/constants/decimal-regex.constant.d.ts +1 -0
  77. package/dist/types/lib/functions/from-boolean-string.function.d.ts +1 -1
  78. package/dist/types/lib/functions/money.function.d.ts +1 -0
  79. package/dist/types/lib/functions/remove-alpha-chars.function.d.ts +1 -0
  80. package/dist/types/lib/functions/to-dollars-and-cents.function.d.ts +1 -1
  81. package/dist/types/lib/functions/to-words.function.d.ts +1 -1
  82. package/package.json +7 -7
@@ -1,3 +1,4 @@
1
+ export * from './lib/constants/decimal-regex.constant';
1
2
  export * from './lib/constants/millis-per-day.constant';
2
3
  export * from './lib/constants/millis-per-hour.constant';
3
4
  export * from './lib/constants/millis-per-minute.constant';
@@ -8,8 +9,10 @@ export * from './lib/functions/from-boolean-string.function';
8
9
  export * from './lib/functions/from-calendar-date.function';
9
10
  export * from './lib/functions/from-csv-string.function';
10
11
  export * from './lib/functions/kebab-case.function';
12
+ export * from './lib/functions/money.function';
11
13
  export * from './lib/functions/parse-bool.function';
12
14
  export * from './lib/functions/properties-to-array.function';
15
+ export * from './lib/functions/remove-alpha-chars.function';
13
16
  export * from './lib/functions/sleep.function';
14
17
  export * from './lib/functions/sanitize-filename.function';
15
18
  export * from './lib/functions/snake-case.function';
package/dist/cjs/index.js CHANGED
@@ -14,6 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./lib/constants/decimal-regex.constant"), exports);
17
18
  __exportStar(require("./lib/constants/millis-per-day.constant"), exports);
18
19
  __exportStar(require("./lib/constants/millis-per-hour.constant"), exports);
19
20
  __exportStar(require("./lib/constants/millis-per-minute.constant"), exports);
@@ -24,8 +25,10 @@ __exportStar(require("./lib/functions/from-boolean-string.function"), exports);
24
25
  __exportStar(require("./lib/functions/from-calendar-date.function"), exports);
25
26
  __exportStar(require("./lib/functions/from-csv-string.function"), exports);
26
27
  __exportStar(require("./lib/functions/kebab-case.function"), exports);
28
+ __exportStar(require("./lib/functions/money.function"), exports);
27
29
  __exportStar(require("./lib/functions/parse-bool.function"), exports);
28
30
  __exportStar(require("./lib/functions/properties-to-array.function"), exports);
31
+ __exportStar(require("./lib/functions/remove-alpha-chars.function"), exports);
29
32
  __exportStar(require("./lib/functions/sleep.function"), exports);
30
33
  __exportStar(require("./lib/functions/sanitize-filename.function"), exports);
31
34
  __exportStar(require("./lib/functions/snake-case.function"), exports);
@@ -0,0 +1 @@
1
+ export declare const decimalRegex: RegExp;
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.decimalRegex = void 0;
4
+ exports.decimalRegex = /(\d|\.)/g;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.addOffset = void 0;
3
+ exports.addOffset = addOffset;
4
4
  const millis_per_minute_constant_1 = require("../constants/millis-per-minute.constant");
5
5
  const try_parse_date_function_1 = require("./try-parse-date.function");
6
6
  function addOffset(input) {
@@ -11,4 +11,3 @@ function addOffset(input) {
11
11
  const offset = (parsed).getTimezoneOffset();
12
12
  return new Date(parsed.valueOf() + offset * millis_per_minute_constant_1.MILLIS_PER_MINUTE);
13
13
  }
14
- exports.addOffset = addOffset;
@@ -1,10 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.convertObjectToLiteral = void 0;
3
+ exports.convertObjectToLiteral = convertObjectToLiteral;
4
4
  function convertObjectToLiteral(literalFn, delimiter, keyValuePairs) {
5
5
  return Object.entries(keyValuePairs)
6
6
  .filter(([, v]) => !!v || v === 0 || v === false)
7
7
  .map(([k, v]) => literalFn(k, v?.toString?.()))
8
8
  .join(delimiter);
9
9
  }
10
- exports.convertObjectToLiteral = convertObjectToLiteral;
@@ -1 +1 @@
1
- export declare function fromBooleanString(value?: string): boolean;
1
+ export declare function fromBooleanString(value?: string): value is "true";
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.fromBooleanString = void 0;
3
+ exports.fromBooleanString = fromBooleanString;
4
4
  function fromBooleanString(value) {
5
5
  return value === 'true';
6
6
  }
7
- exports.fromBooleanString = fromBooleanString;
@@ -1,8 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.fromCalendarDate = void 0;
3
+ exports.fromCalendarDate = fromCalendarDate;
4
4
  const add_offset_function_1 = require("./add-offset.function");
5
5
  function fromCalendarDate(input) {
6
6
  return (0, add_offset_function_1.addOffset)(input) || null;
7
7
  }
8
- exports.fromCalendarDate = fromCalendarDate;
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.fromCsvString = void 0;
3
+ exports.fromCsvString = fromCsvString;
4
4
  function fromCsvString(value) {
5
5
  return value ? value.split(',').map((v) => v.trim()) : [];
6
6
  }
7
- exports.fromCsvString = fromCsvString;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  // https://github.com/lodash/lodash/blob/main/src/.internal/getTag.ts
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.getTag = void 0;
4
+ exports.getTag = getTag;
5
5
  const toString = Object.prototype.toString;
6
6
  function getTag(value) {
7
7
  if (value == null) {
@@ -9,4 +9,3 @@ function getTag(value) {
9
9
  }
10
10
  return toString.call(value);
11
11
  }
12
- exports.getTag = getTag;
@@ -1,11 +1,10 @@
1
1
  "use strict";
2
2
  // https://github.com/lodash/lodash/blob/main/src/isSymbol.ts
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.isSymbol = void 0;
4
+ exports.isSymbol = isSymbol;
5
5
  const get_tag_function_1 = require("./get-tag.function");
6
6
  function isSymbol(value) {
7
7
  const type = typeof value;
8
8
  return (type === 'symbol' ||
9
9
  (type === 'object' && value != null && (0, get_tag_function_1.getTag)(value) === '[object Symbol]'));
10
10
  }
11
- exports.isSymbol = isSymbol;
@@ -1,8 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.kebabCase = void 0;
3
+ exports.kebabCase = kebabCase;
4
4
  const snake_case_function_1 = require("./snake-case.function");
5
5
  function kebabCase(string) {
6
6
  return (0, snake_case_function_1.snakeCase)(string).replace(/_/g, '-');
7
7
  }
8
- exports.kebabCase = kebabCase;
@@ -0,0 +1 @@
1
+ export declare function money(rawValue: number | string): string;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.money = money;
4
+ const remove_alpha_chars_function_1 = require("./remove-alpha-chars.function");
5
+ function money(rawValue) {
6
+ if (!rawValue) {
7
+ return;
8
+ }
9
+ const scrubbed = (0, remove_alpha_chars_function_1.removeAlphaChars)(rawValue);
10
+ const amount = Number(scrubbed);
11
+ if (!amount && amount !== 0) {
12
+ return;
13
+ }
14
+ const formatter = new Intl.NumberFormat('en-US', {
15
+ style: 'currency',
16
+ currency: 'USD'
17
+ });
18
+ return formatter.format(Number(amount));
19
+ }
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.parseBool = void 0;
3
+ exports.parseBool = parseBool;
4
4
  function parseBool(asc) {
5
5
  return asc ? asc === true || asc === 'true' : false;
6
6
  }
7
- exports.parseBool = parseBool;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  // credit https://stackoverflow.com/questions/15690706/recursively-looping-through-an-object-to-build-a-property-list/53620876#53620876
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.propertiesToArray = void 0;
4
+ exports.propertiesToArray = propertiesToArray;
5
5
  function propertiesToArray(obj) {
6
6
  const isObject = val => val && typeof val === 'object' && !Array.isArray(val);
7
7
  const addDelimiter = (a, b) => a ? `${a}.${b}` : b;
@@ -16,4 +16,3 @@ function propertiesToArray(obj) {
16
16
  };
17
17
  return paths(obj);
18
18
  }
19
- exports.propertiesToArray = propertiesToArray;
@@ -0,0 +1 @@
1
+ export declare function removeAlphaChars(input?: string | number): string;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.removeAlphaChars = removeAlphaChars;
4
+ const decimal_regex_constant_1 = require("../constants/decimal-regex.constant");
5
+ function removeAlphaChars(input) {
6
+ if (!input) {
7
+ return;
8
+ }
9
+ return input.toString().match(decimal_regex_constant_1.decimalRegex).join('');
10
+ }
@@ -1,11 +1,10 @@
1
1
  "use strict";
2
2
  /* eslint-disable no-control-regex */
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.sanitizeFilename = void 0;
4
+ exports.sanitizeFilename = sanitizeFilename;
5
5
  const _ = '_';
6
6
  const asciiReplacementRegX = /\/|\?|:|\\|{|\^|'|\}|%|`|]|>|\[|~|<|#|\||"|!|\*/g;
7
7
  const unicodeReplacementRegX = /[^\u0000-\u007F]/g;
8
8
  function sanitizeFilename(filename) {
9
9
  return filename.replace(unicodeReplacementRegX, _).replace(asciiReplacementRegX, _).replace(/_+/g, _).trim();
10
10
  }
11
- exports.sanitizeFilename = sanitizeFilename;
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.sleep = void 0;
3
+ exports.sleep = sleep;
4
4
  async function sleep(milliseconds = 0) {
5
5
  return await new Promise(resolve => setTimeout(resolve, milliseconds));
6
6
  }
7
- exports.sleep = sleep;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  // source https://github.com/lodash/lodash/blob/master/snakeCase.js
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.snakeCase = void 0;
4
+ exports.snakeCase = snakeCase;
5
5
  const words_function_1 = require("./words.function");
6
6
  /**
7
7
  * Converts `string` to
@@ -29,4 +29,3 @@ const words_function_1 = require("./words.function");
29
29
  function snakeCase(string) {
30
30
  return ((0, words_function_1.words)(string.replace(/['\u2019]/g, '')).reduce((result, word, index) => (result + (index ? '_' : '') + word.toLowerCase()), ''));
31
31
  }
32
- exports.snakeCase = snakeCase;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.subtractOffset = void 0;
3
+ exports.subtractOffset = subtractOffset;
4
4
  const millis_per_minute_constant_1 = require("../constants/millis-per-minute.constant");
5
5
  const try_parse_date_function_1 = require("./try-parse-date.function");
6
6
  function subtractOffset(input) {
@@ -11,4 +11,3 @@ function subtractOffset(input) {
11
11
  const offset = (parsed).getTimezoneOffset();
12
12
  return new Date(parsed.valueOf() - offset * millis_per_minute_constant_1.MILLIS_PER_MINUTE);
13
13
  }
14
- exports.subtractOffset = subtractOffset;
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.toBooleanString = void 0;
3
+ exports.toBooleanString = toBooleanString;
4
4
  function toBooleanString(val) {
5
5
  return (!!(val || false)).toString();
6
6
  }
7
- exports.toBooleanString = toBooleanString;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.toCalendarDate = void 0;
3
+ exports.toCalendarDate = toCalendarDate;
4
4
  const subtract_offset_function_1 = require("./subtract-offset.function");
5
5
  function toCalendarDate(input) {
6
6
  const parsed = (0, subtract_offset_function_1.subtractOffset)(input);
@@ -9,4 +9,3 @@ function toCalendarDate(input) {
9
9
  }
10
10
  return parsed?.toISOString().split('T')[0];
11
11
  }
12
- exports.toCalendarDate = toCalendarDate;
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.toCsvString = void 0;
3
+ exports.toCsvString = toCsvString;
4
4
  function toCsvString(val) {
5
5
  return (val || []).join(',');
6
6
  }
7
- exports.toCsvString = toCsvString;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.toDecimalBase = void 0;
3
+ exports.toDecimalBase = toDecimalBase;
4
4
  function toDecimalBase(n, base = 16) {
5
5
  const digits = n.toString().split('');
6
6
  let answer = 0;
@@ -19,4 +19,3 @@ function toDecimalBase(n, base = 16) {
19
19
  });
20
20
  return answer;
21
21
  }
22
- exports.toDecimalBase = toDecimalBase;
@@ -1 +1 @@
1
- export declare function toDollarsAndCents(number: any): string;
1
+ export declare function toDollarsAndCents(input: string | number): string;
@@ -1,8 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.toDollarsAndCents = void 0;
3
+ exports.toDollarsAndCents = toDollarsAndCents;
4
+ const remove_alpha_chars_function_1 = require("./remove-alpha-chars.function");
4
5
  const to_words_function_1 = require("./to-words.function");
5
- function toDollarsAndCents(number) {
6
+ function toDollarsAndCents(input) {
7
+ const number = (0, remove_alpha_chars_function_1.removeAlphaChars)(input);
6
8
  const num = Number(number);
7
9
  const decimal = (Math.round((num % 1) * 100)) / 100;
8
10
  const int = num - decimal;
@@ -12,4 +14,3 @@ function toDollarsAndCents(number) {
12
14
  }
13
15
  return `${dollars} and ${(0, to_words_function_1.toWords)(decimal * 100)} cents`;
14
16
  }
15
- exports.toDollarsAndCents = toDollarsAndCents;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  // https://github.com/lodash/lodash/blob/main/src/toString.ts
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.toString = void 0;
4
+ exports.toString = toString;
5
5
  const is_symbol_function_1 = require("./is-symbol.function");
6
6
  /** Used as references for various `Number` constants. */
7
7
  const INFINITY = 1 / 0;
@@ -23,4 +23,3 @@ function toString(value) {
23
23
  const result = `${value}`;
24
24
  return result === '0' && 1 / value === -INFINITY ? '-0' : result;
25
25
  }
26
- exports.toString = toString;
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.toUniqueArray = void 0;
3
+ exports.toUniqueArray = toUniqueArray;
4
4
  function toUniqueArray(elements) {
5
5
  return Array.from(new Set(elements));
6
6
  }
7
- exports.toUniqueArray = toUniqueArray;
@@ -1 +1 @@
1
- export declare function toWords(number: any): string;
1
+ export declare function toWords(input: any): string;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.toWords = void 0;
3
+ exports.toWords = toWords;
4
+ const remove_alpha_chars_function_1 = require("./remove-alpha-chars.function");
4
5
  const MAX_SAFE_INTEGER = 9007199254740991;
5
6
  const TEN = 10;
6
7
  const ONE_HUNDRED = 100;
@@ -17,8 +18,9 @@ const LESS_THAN_TWENTY = [
17
18
  const TENTHS_LESS_THAN_HUNDRED = [
18
19
  'zero', 'ten', 'twenty', 'thirty', 'forty', 'fifty', 'sixty', 'seventy', 'eighty', 'ninety'
19
20
  ];
20
- function toWords(number) {
21
+ function toWords(input) {
21
22
  let words;
23
+ const number = (0, remove_alpha_chars_function_1.removeAlphaChars)(input);
22
24
  const num = parseInt(number, 10);
23
25
  if (!isFinite(num)) {
24
26
  throw new TypeError('Not a finite number: ' + number + ' (' + typeof number + ')');
@@ -29,7 +31,6 @@ function toWords(number) {
29
31
  words = generateWords(num);
30
32
  return words;
31
33
  }
32
- exports.toWords = toWords;
33
34
  function generateWords(number, words) {
34
35
  let remainder, word;
35
36
  if (number === 0) {
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.tryParseDate = void 0;
3
+ exports.tryParseDate = tryParseDate;
4
4
  function tryParseDate(input) {
5
5
  if (!input) {
6
6
  return;
@@ -14,4 +14,3 @@ function tryParseDate(input) {
14
14
  }
15
15
  return date;
16
16
  }
17
- exports.tryParseDate = tryParseDate;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  // source https://github.com/lodash/lodash/blob/master/.internal/unicodeWords.js
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.unicodeWords = void 0;
4
+ exports.unicodeWords = unicodeWords;
5
5
  /** Used to compose unicode character classes. */
6
6
  const rsAstralRange = '\\ud800-\\udfff';
7
7
  const rsComboMarksRange = '\\u0300-\\u036f';
@@ -66,4 +66,3 @@ const reUnicodeWords = RegExp([
66
66
  function unicodeWords(string) {
67
67
  return string.match(reUnicodeWords);
68
68
  }
69
- exports.unicodeWords = unicodeWords;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.upperFirst = void 0;
3
+ exports.upperFirst = upperFirst;
4
4
  function upperFirst(string) {
5
5
  if (!string) {
6
6
  return string;
@@ -10,4 +10,3 @@ function upperFirst(string) {
10
10
  .map((curr, i) => curr[!i ? 'toUpperCase' : 'toLowerCase']())
11
11
  .join('');
12
12
  }
13
- exports.upperFirst = upperFirst;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  // source https://github.com/lodash/lodash/blob/master/words.js
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.words = void 0;
4
+ exports.words = words;
5
5
  const unicode_words_const_1 = require("./unicode-words.const");
6
6
  const hasUnicodeWord = RegExp.prototype.test.bind(/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/);
7
7
  /** Used to match words composed of alphanumeric characters. */
@@ -32,4 +32,3 @@ function words(string, pattern) {
32
32
  }
33
33
  return string.match(pattern) || [];
34
34
  }
35
- exports.words = words;
@@ -1,3 +1,4 @@
1
+ export * from './lib/constants/decimal-regex.constant';
1
2
  export * from './lib/constants/millis-per-day.constant';
2
3
  export * from './lib/constants/millis-per-hour.constant';
3
4
  export * from './lib/constants/millis-per-minute.constant';
@@ -8,8 +9,10 @@ export * from './lib/functions/from-boolean-string.function';
8
9
  export * from './lib/functions/from-calendar-date.function';
9
10
  export * from './lib/functions/from-csv-string.function';
10
11
  export * from './lib/functions/kebab-case.function';
12
+ export * from './lib/functions/money.function';
11
13
  export * from './lib/functions/parse-bool.function';
12
14
  export * from './lib/functions/properties-to-array.function';
15
+ export * from './lib/functions/remove-alpha-chars.function';
13
16
  export * from './lib/functions/sleep.function';
14
17
  export * from './lib/functions/sanitize-filename.function';
15
18
  export * from './lib/functions/snake-case.function';
package/dist/esm/index.js CHANGED
@@ -14,6 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./lib/constants/decimal-regex.constant"), exports);
17
18
  __exportStar(require("./lib/constants/millis-per-day.constant"), exports);
18
19
  __exportStar(require("./lib/constants/millis-per-hour.constant"), exports);
19
20
  __exportStar(require("./lib/constants/millis-per-minute.constant"), exports);
@@ -24,8 +25,10 @@ __exportStar(require("./lib/functions/from-boolean-string.function"), exports);
24
25
  __exportStar(require("./lib/functions/from-calendar-date.function"), exports);
25
26
  __exportStar(require("./lib/functions/from-csv-string.function"), exports);
26
27
  __exportStar(require("./lib/functions/kebab-case.function"), exports);
28
+ __exportStar(require("./lib/functions/money.function"), exports);
27
29
  __exportStar(require("./lib/functions/parse-bool.function"), exports);
28
30
  __exportStar(require("./lib/functions/properties-to-array.function"), exports);
31
+ __exportStar(require("./lib/functions/remove-alpha-chars.function"), exports);
29
32
  __exportStar(require("./lib/functions/sleep.function"), exports);
30
33
  __exportStar(require("./lib/functions/sanitize-filename.function"), exports);
31
34
  __exportStar(require("./lib/functions/snake-case.function"), exports);
@@ -0,0 +1 @@
1
+ export declare const decimalRegex: RegExp;
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.decimalRegex = void 0;
4
+ exports.decimalRegex = /(\d|\.)/g;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.addOffset = void 0;
3
+ exports.addOffset = addOffset;
4
4
  const millis_per_minute_constant_1 = require("../constants/millis-per-minute.constant");
5
5
  const try_parse_date_function_1 = require("./try-parse-date.function");
6
6
  function addOffset(input) {
@@ -11,4 +11,3 @@ function addOffset(input) {
11
11
  const offset = (parsed).getTimezoneOffset();
12
12
  return new Date(parsed.valueOf() + offset * millis_per_minute_constant_1.MILLIS_PER_MINUTE);
13
13
  }
14
- exports.addOffset = addOffset;
@@ -1,10 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.convertObjectToLiteral = void 0;
3
+ exports.convertObjectToLiteral = convertObjectToLiteral;
4
4
  function convertObjectToLiteral(literalFn, delimiter, keyValuePairs) {
5
5
  return Object.entries(keyValuePairs)
6
6
  .filter(([, v]) => !!v || v === 0 || v === false)
7
7
  .map(([k, v]) => literalFn(k, v?.toString?.()))
8
8
  .join(delimiter);
9
9
  }
10
- exports.convertObjectToLiteral = convertObjectToLiteral;
@@ -1 +1 @@
1
- export declare function fromBooleanString(value?: string): boolean;
1
+ export declare function fromBooleanString(value?: string): value is "true";
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.fromBooleanString = void 0;
3
+ exports.fromBooleanString = fromBooleanString;
4
4
  function fromBooleanString(value) {
5
5
  return value === 'true';
6
6
  }
7
- exports.fromBooleanString = fromBooleanString;
@@ -1,8 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.fromCalendarDate = void 0;
3
+ exports.fromCalendarDate = fromCalendarDate;
4
4
  const add_offset_function_1 = require("./add-offset.function");
5
5
  function fromCalendarDate(input) {
6
6
  return (0, add_offset_function_1.addOffset)(input) || null;
7
7
  }
8
- exports.fromCalendarDate = fromCalendarDate;
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.fromCsvString = void 0;
3
+ exports.fromCsvString = fromCsvString;
4
4
  function fromCsvString(value) {
5
5
  return value ? value.split(',').map((v) => v.trim()) : [];
6
6
  }
7
- exports.fromCsvString = fromCsvString;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  // https://github.com/lodash/lodash/blob/main/src/.internal/getTag.ts
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.getTag = void 0;
4
+ exports.getTag = getTag;
5
5
  const toString = Object.prototype.toString;
6
6
  function getTag(value) {
7
7
  if (value == null) {
@@ -9,4 +9,3 @@ function getTag(value) {
9
9
  }
10
10
  return toString.call(value);
11
11
  }
12
- exports.getTag = getTag;
@@ -1,11 +1,10 @@
1
1
  "use strict";
2
2
  // https://github.com/lodash/lodash/blob/main/src/isSymbol.ts
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.isSymbol = void 0;
4
+ exports.isSymbol = isSymbol;
5
5
  const get_tag_function_1 = require("./get-tag.function");
6
6
  function isSymbol(value) {
7
7
  const type = typeof value;
8
8
  return (type === 'symbol' ||
9
9
  (type === 'object' && value != null && (0, get_tag_function_1.getTag)(value) === '[object Symbol]'));
10
10
  }
11
- exports.isSymbol = isSymbol;
@@ -1,8 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.kebabCase = void 0;
3
+ exports.kebabCase = kebabCase;
4
4
  const snake_case_function_1 = require("./snake-case.function");
5
5
  function kebabCase(string) {
6
6
  return (0, snake_case_function_1.snakeCase)(string).replace(/_/g, '-');
7
7
  }
8
- exports.kebabCase = kebabCase;
@@ -0,0 +1 @@
1
+ export declare function money(rawValue: number | string): string;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.money = money;
4
+ const remove_alpha_chars_function_1 = require("./remove-alpha-chars.function");
5
+ function money(rawValue) {
6
+ if (!rawValue) {
7
+ return;
8
+ }
9
+ const scrubbed = (0, remove_alpha_chars_function_1.removeAlphaChars)(rawValue);
10
+ const amount = Number(scrubbed);
11
+ if (!amount && amount !== 0) {
12
+ return;
13
+ }
14
+ const formatter = new Intl.NumberFormat('en-US', {
15
+ style: 'currency',
16
+ currency: 'USD'
17
+ });
18
+ return formatter.format(Number(amount));
19
+ }
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.parseBool = void 0;
3
+ exports.parseBool = parseBool;
4
4
  function parseBool(asc) {
5
5
  return asc ? asc === true || asc === 'true' : false;
6
6
  }
7
- exports.parseBool = parseBool;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  // credit https://stackoverflow.com/questions/15690706/recursively-looping-through-an-object-to-build-a-property-list/53620876#53620876
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.propertiesToArray = void 0;
4
+ exports.propertiesToArray = propertiesToArray;
5
5
  function propertiesToArray(obj) {
6
6
  const isObject = val => val && typeof val === 'object' && !Array.isArray(val);
7
7
  const addDelimiter = (a, b) => a ? `${a}.${b}` : b;
@@ -16,4 +16,3 @@ function propertiesToArray(obj) {
16
16
  };
17
17
  return paths(obj);
18
18
  }
19
- exports.propertiesToArray = propertiesToArray;
@@ -0,0 +1 @@
1
+ export declare function removeAlphaChars(input?: string | number): string;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.removeAlphaChars = removeAlphaChars;
4
+ const decimal_regex_constant_1 = require("../constants/decimal-regex.constant");
5
+ function removeAlphaChars(input) {
6
+ if (!input) {
7
+ return;
8
+ }
9
+ return input.toString().match(decimal_regex_constant_1.decimalRegex).join('');
10
+ }
@@ -1,11 +1,10 @@
1
1
  "use strict";
2
2
  /* eslint-disable no-control-regex */
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.sanitizeFilename = void 0;
4
+ exports.sanitizeFilename = sanitizeFilename;
5
5
  const _ = '_';
6
6
  const asciiReplacementRegX = /\/|\?|:|\\|{|\^|'|\}|%|`|]|>|\[|~|<|#|\||"|!|\*/g;
7
7
  const unicodeReplacementRegX = /[^\u0000-\u007F]/g;
8
8
  function sanitizeFilename(filename) {
9
9
  return filename.replace(unicodeReplacementRegX, _).replace(asciiReplacementRegX, _).replace(/_+/g, _).trim();
10
10
  }
11
- exports.sanitizeFilename = sanitizeFilename;
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.sleep = void 0;
3
+ exports.sleep = sleep;
4
4
  async function sleep(milliseconds = 0) {
5
5
  return await new Promise(resolve => setTimeout(resolve, milliseconds));
6
6
  }
7
- exports.sleep = sleep;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  // source https://github.com/lodash/lodash/blob/master/snakeCase.js
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.snakeCase = void 0;
4
+ exports.snakeCase = snakeCase;
5
5
  const words_function_1 = require("./words.function");
6
6
  /**
7
7
  * Converts `string` to
@@ -29,4 +29,3 @@ const words_function_1 = require("./words.function");
29
29
  function snakeCase(string) {
30
30
  return ((0, words_function_1.words)(string.replace(/['\u2019]/g, '')).reduce((result, word, index) => (result + (index ? '_' : '') + word.toLowerCase()), ''));
31
31
  }
32
- exports.snakeCase = snakeCase;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.subtractOffset = void 0;
3
+ exports.subtractOffset = subtractOffset;
4
4
  const millis_per_minute_constant_1 = require("../constants/millis-per-minute.constant");
5
5
  const try_parse_date_function_1 = require("./try-parse-date.function");
6
6
  function subtractOffset(input) {
@@ -11,4 +11,3 @@ function subtractOffset(input) {
11
11
  const offset = (parsed).getTimezoneOffset();
12
12
  return new Date(parsed.valueOf() - offset * millis_per_minute_constant_1.MILLIS_PER_MINUTE);
13
13
  }
14
- exports.subtractOffset = subtractOffset;
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.toBooleanString = void 0;
3
+ exports.toBooleanString = toBooleanString;
4
4
  function toBooleanString(val) {
5
5
  return (!!(val || false)).toString();
6
6
  }
7
- exports.toBooleanString = toBooleanString;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.toCalendarDate = void 0;
3
+ exports.toCalendarDate = toCalendarDate;
4
4
  const subtract_offset_function_1 = require("./subtract-offset.function");
5
5
  function toCalendarDate(input) {
6
6
  const parsed = (0, subtract_offset_function_1.subtractOffset)(input);
@@ -9,4 +9,3 @@ function toCalendarDate(input) {
9
9
  }
10
10
  return parsed?.toISOString().split('T')[0];
11
11
  }
12
- exports.toCalendarDate = toCalendarDate;
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.toCsvString = void 0;
3
+ exports.toCsvString = toCsvString;
4
4
  function toCsvString(val) {
5
5
  return (val || []).join(',');
6
6
  }
7
- exports.toCsvString = toCsvString;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.toDecimalBase = void 0;
3
+ exports.toDecimalBase = toDecimalBase;
4
4
  function toDecimalBase(n, base = 16) {
5
5
  const digits = n.toString().split('');
6
6
  let answer = 0;
@@ -19,4 +19,3 @@ function toDecimalBase(n, base = 16) {
19
19
  });
20
20
  return answer;
21
21
  }
22
- exports.toDecimalBase = toDecimalBase;
@@ -1 +1 @@
1
- export declare function toDollarsAndCents(number: any): string;
1
+ export declare function toDollarsAndCents(input: string | number): string;
@@ -1,8 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.toDollarsAndCents = void 0;
3
+ exports.toDollarsAndCents = toDollarsAndCents;
4
+ const remove_alpha_chars_function_1 = require("./remove-alpha-chars.function");
4
5
  const to_words_function_1 = require("./to-words.function");
5
- function toDollarsAndCents(number) {
6
+ function toDollarsAndCents(input) {
7
+ const number = (0, remove_alpha_chars_function_1.removeAlphaChars)(input);
6
8
  const num = Number(number);
7
9
  const decimal = (Math.round((num % 1) * 100)) / 100;
8
10
  const int = num - decimal;
@@ -12,4 +14,3 @@ function toDollarsAndCents(number) {
12
14
  }
13
15
  return `${dollars} and ${(0, to_words_function_1.toWords)(decimal * 100)} cents`;
14
16
  }
15
- exports.toDollarsAndCents = toDollarsAndCents;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  // https://github.com/lodash/lodash/blob/main/src/toString.ts
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.toString = void 0;
4
+ exports.toString = toString;
5
5
  const is_symbol_function_1 = require("./is-symbol.function");
6
6
  /** Used as references for various `Number` constants. */
7
7
  const INFINITY = 1 / 0;
@@ -23,4 +23,3 @@ function toString(value) {
23
23
  const result = `${value}`;
24
24
  return result === '0' && 1 / value === -INFINITY ? '-0' : result;
25
25
  }
26
- exports.toString = toString;
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.toUniqueArray = void 0;
3
+ exports.toUniqueArray = toUniqueArray;
4
4
  function toUniqueArray(elements) {
5
5
  return Array.from(new Set(elements));
6
6
  }
7
- exports.toUniqueArray = toUniqueArray;
@@ -1 +1 @@
1
- export declare function toWords(number: any): string;
1
+ export declare function toWords(input: any): string;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.toWords = void 0;
3
+ exports.toWords = toWords;
4
+ const remove_alpha_chars_function_1 = require("./remove-alpha-chars.function");
4
5
  const MAX_SAFE_INTEGER = 9007199254740991;
5
6
  const TEN = 10;
6
7
  const ONE_HUNDRED = 100;
@@ -17,8 +18,9 @@ const LESS_THAN_TWENTY = [
17
18
  const TENTHS_LESS_THAN_HUNDRED = [
18
19
  'zero', 'ten', 'twenty', 'thirty', 'forty', 'fifty', 'sixty', 'seventy', 'eighty', 'ninety'
19
20
  ];
20
- function toWords(number) {
21
+ function toWords(input) {
21
22
  let words;
23
+ const number = (0, remove_alpha_chars_function_1.removeAlphaChars)(input);
22
24
  const num = parseInt(number, 10);
23
25
  if (!isFinite(num)) {
24
26
  throw new TypeError('Not a finite number: ' + number + ' (' + typeof number + ')');
@@ -29,7 +31,6 @@ function toWords(number) {
29
31
  words = generateWords(num);
30
32
  return words;
31
33
  }
32
- exports.toWords = toWords;
33
34
  function generateWords(number, words) {
34
35
  let remainder, word;
35
36
  if (number === 0) {
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.tryParseDate = void 0;
3
+ exports.tryParseDate = tryParseDate;
4
4
  function tryParseDate(input) {
5
5
  if (!input) {
6
6
  return;
@@ -14,4 +14,3 @@ function tryParseDate(input) {
14
14
  }
15
15
  return date;
16
16
  }
17
- exports.tryParseDate = tryParseDate;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  // source https://github.com/lodash/lodash/blob/master/.internal/unicodeWords.js
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.unicodeWords = void 0;
4
+ exports.unicodeWords = unicodeWords;
5
5
  /** Used to compose unicode character classes. */
6
6
  const rsAstralRange = '\\ud800-\\udfff';
7
7
  const rsComboMarksRange = '\\u0300-\\u036f';
@@ -66,4 +66,3 @@ const reUnicodeWords = RegExp([
66
66
  function unicodeWords(string) {
67
67
  return string.match(reUnicodeWords);
68
68
  }
69
- exports.unicodeWords = unicodeWords;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.upperFirst = void 0;
3
+ exports.upperFirst = upperFirst;
4
4
  function upperFirst(string) {
5
5
  if (!string) {
6
6
  return string;
@@ -10,4 +10,3 @@ function upperFirst(string) {
10
10
  .map((curr, i) => curr[!i ? 'toUpperCase' : 'toLowerCase']())
11
11
  .join('');
12
12
  }
13
- exports.upperFirst = upperFirst;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  // source https://github.com/lodash/lodash/blob/master/words.js
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.words = void 0;
4
+ exports.words = words;
5
5
  const unicode_words_const_1 = require("./unicode-words.const");
6
6
  const hasUnicodeWord = RegExp.prototype.test.bind(/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/);
7
7
  /** Used to match words composed of alphanumeric characters. */
@@ -32,4 +32,3 @@ function words(string, pattern) {
32
32
  }
33
33
  return string.match(pattern) || [];
34
34
  }
35
- exports.words = words;
@@ -1,3 +1,4 @@
1
+ export * from './lib/constants/decimal-regex.constant';
1
2
  export * from './lib/constants/millis-per-day.constant';
2
3
  export * from './lib/constants/millis-per-hour.constant';
3
4
  export * from './lib/constants/millis-per-minute.constant';
@@ -8,8 +9,10 @@ export * from './lib/functions/from-boolean-string.function';
8
9
  export * from './lib/functions/from-calendar-date.function';
9
10
  export * from './lib/functions/from-csv-string.function';
10
11
  export * from './lib/functions/kebab-case.function';
12
+ export * from './lib/functions/money.function';
11
13
  export * from './lib/functions/parse-bool.function';
12
14
  export * from './lib/functions/properties-to-array.function';
15
+ export * from './lib/functions/remove-alpha-chars.function';
13
16
  export * from './lib/functions/sleep.function';
14
17
  export * from './lib/functions/sanitize-filename.function';
15
18
  export * from './lib/functions/snake-case.function';
@@ -0,0 +1 @@
1
+ export declare const decimalRegex: RegExp;
@@ -1 +1 @@
1
- export declare function fromBooleanString(value?: string): boolean;
1
+ export declare function fromBooleanString(value?: string): value is "true";
@@ -0,0 +1 @@
1
+ export declare function money(rawValue: number | string): string;
@@ -0,0 +1 @@
1
+ export declare function removeAlphaChars(input?: string | number): string;
@@ -1 +1 @@
1
- export declare function toDollarsAndCents(number: any): string;
1
+ export declare function toDollarsAndCents(input: string | number): string;
@@ -1 +1 @@
1
- export declare function toWords(number: any): string;
1
+ export declare function toWords(input: any): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onivoro/isomorphic-common",
3
- "version": "0.4.2",
3
+ "version": "22.0.0",
4
4
  "repository": {
5
5
  "url": "git+https://github.com/onivoro/isomorphic-common.git"
6
6
  },
@@ -30,12 +30,12 @@
30
30
  "module": "commonjs"
31
31
  },
32
32
  "devDependencies": {
33
- "@onivoro/cli": "^0.0.32",
34
- "@types/jest": "^29.5.12",
35
- "typescript": "^5.3.3"
33
+ "@onivoro/cli": "^22.0.3",
34
+ "@types/jest": "*",
35
+ "typescript": "*"
36
36
  },
37
37
  "engines": {
38
- "node": "18.19.1",
39
- "npm": "10.2.4"
38
+ "node": "22.10.0",
39
+ "npm": "10.9.0"
40
40
  }
41
- }
41
+ }