@heyform-inc/utils 1.2.0 → 1.2.2

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/dist/index.mjs CHANGED
@@ -9,7 +9,7 @@ import _isURL from 'validator/lib/isURL';
9
9
  import _clone from 'clone';
10
10
  import { convert } from 'html-to-text';
11
11
  import _ms from 'ms';
12
- import dayjs from 'dayjs';
12
+ import _dayjs from 'dayjs';
13
13
  import { customAlphabet } from 'nanoid';
14
14
  import * as objectPath from 'object-path';
15
15
  export { deepEqual } from 'fast-equals';
@@ -400,7 +400,9 @@ function toFloat(value, defaults, maxValue) {
400
400
  return maxValue ? Math.min(maxValue, val) : val;
401
401
  }
402
402
  function toFixed(value, precision = 2) {
403
- return value.toFixed(precision).replace(/(\.\d*?)0+$/, "$1").replace(/\.$/, "");
403
+ if (isNumber(value)) {
404
+ return value.toFixed(precision).replace(/(\.\d*?)0+$/, "$1").replace(/\.$/, "");
405
+ }
404
406
  }
405
407
  function toJSON(str, defaults) {
406
408
  let value;
@@ -516,11 +518,10 @@ var toMillisecond = ms;
516
518
  function timestamp() {
517
519
  return Math.floor(Date.now() / 1e3);
518
520
  }
519
- function date(str, format) {
520
- return dayjs(str, format);
521
- }
521
+ var dayjs = _dayjs;
522
+ var date = dayjs;
522
523
  function unixDate(t) {
523
- return dayjs.unix(t);
524
+ return date.unix(t);
524
525
  }
525
526
  function isDateExpired(start, end, expire) {
526
527
  return end - start > hs(expire);
@@ -1921,6 +1922,6 @@ function slugify(text, options) {
1921
1922
  });
1922
1923
  }
1923
1924
 
1924
- export { FILE_MIME_TYPES, IMAGE_MIME_TYPES, RandomType, alpha, alphaHexToRgb, bytes, clone, colorBrightness, commonFileMimeTypes, commonImageMimeTypes, copyObjectValues, darken, date, datePeriod, excludeObject, formatBytes, helper_default as helper, hexToRgb, hs, htmlToText, invert, isDarkColor, isDateExpired, isHexColor, isLightColor, isRgb, isRgba, lighten, mime, ms, nanoid, nanoidCustomAlphabet, parseBool, parseBytes, parseJson, parseNumber, pickObject, pickValidValues, random, removeObjectNil, rgbToHex, slugify, timestamp, toBool, toDuration, toFixed, toFloat, toInt, toInteger, toIntlNumber, toJSON, toMillisecond, toSecond, toURLParams, toURLQuery, type, unixDate, unixDiff };
1925
+ export { FILE_MIME_TYPES, IMAGE_MIME_TYPES, RandomType, alpha, alphaHexToRgb, bytes, clone, colorBrightness, commonFileMimeTypes, commonImageMimeTypes, copyObjectValues, darken, date, datePeriod, dayjs, excludeObject, formatBytes, helper_default as helper, hexToRgb, hs, htmlToText, invert, isDarkColor, isDateExpired, isHexColor, isLightColor, isRgb, isRgba, lighten, mime, ms, nanoid, nanoidCustomAlphabet, parseBool, parseBytes, parseJson, parseNumber, pickObject, pickValidValues, random, removeObjectNil, rgbToHex, slugify, timestamp, toBool, toDuration, toFixed, toFloat, toInt, toInteger, toIntlNumber, toJSON, toMillisecond, toSecond, toURLParams, toURLQuery, type, unixDate, unixDiff };
1925
1926
  //# sourceMappingURL=out.js.map
1926
1927
  //# sourceMappingURL=index.mjs.map