@heyform-inc/utils 1.2.1 → 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.d.mts CHANGED
@@ -1,7 +1,7 @@
1
1
  export * from 'deep-object-diff';
2
2
  import { IParseOptions, IStringifyOptions } from 'qs';
3
3
  export { default as qs } from 'qs';
4
- import dayjs, { QUnitType, OpUnitType } from 'dayjs';
4
+ import _dayjs, { QUnitType, OpUnitType } from 'dayjs';
5
5
  import _isUUID from 'validator/lib/isUUID';
6
6
  import _isFQDN from 'validator/lib/isFQDN';
7
7
  import { IsNumericOptions } from 'validator/lib/isNumeric';
@@ -53,8 +53,9 @@ declare function toURLQuery(value: Record<string | number, any>, baseUri?: strin
53
53
  declare function htmlToText(html: string, limit?: number): string;
54
54
 
55
55
  declare function timestamp(): number;
56
- declare function date(str?: string, format?: string): dayjs.Dayjs;
57
- declare function unixDate(t: number): dayjs.Dayjs;
56
+ declare const dayjs: typeof _dayjs;
57
+ declare const date: typeof _dayjs;
58
+ declare function unixDate(t: number): _dayjs.Dayjs;
58
59
  declare function isDateExpired(start: number, end: number, expire: string): boolean;
59
60
  declare function unixDiff(start: number, end: number, unit?: QUnitType | OpUnitType): number;
60
61
  declare function datePeriod(start: number, value?: number, unit?: OpUnitType): number;
@@ -168,4 +169,4 @@ declare function slugify(text: string, options?: SlugifyOptions): string;
168
169
 
169
170
  declare function type(obj: any): string;
170
171
 
171
- export { FILE_MIME_TYPES, IMAGE_MIME_TYPES, RandomType, type SlugifyOptions, alpha, alphaHexToRgb, bytes, clone, colorBrightness, commonFileMimeTypes, commonImageMimeTypes, copyObjectValues, darken, date, datePeriod, excludeObject, formatBytes, _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 };
172
+ export { FILE_MIME_TYPES, IMAGE_MIME_TYPES, RandomType, type SlugifyOptions, alpha, alphaHexToRgb, bytes, clone, colorBrightness, commonFileMimeTypes, commonImageMimeTypes, copyObjectValues, darken, date, datePeriod, dayjs, excludeObject, formatBytes, _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 };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export * from 'deep-object-diff';
2
2
  import { IParseOptions, IStringifyOptions } from 'qs';
3
3
  export { default as qs } from 'qs';
4
- import dayjs, { QUnitType, OpUnitType } from 'dayjs';
4
+ import _dayjs, { QUnitType, OpUnitType } from 'dayjs';
5
5
  import _isUUID from 'validator/lib/isUUID';
6
6
  import _isFQDN from 'validator/lib/isFQDN';
7
7
  import { IsNumericOptions } from 'validator/lib/isNumeric';
@@ -53,8 +53,9 @@ declare function toURLQuery(value: Record<string | number, any>, baseUri?: strin
53
53
  declare function htmlToText(html: string, limit?: number): string;
54
54
 
55
55
  declare function timestamp(): number;
56
- declare function date(str?: string, format?: string): dayjs.Dayjs;
57
- declare function unixDate(t: number): dayjs.Dayjs;
56
+ declare const dayjs: typeof _dayjs;
57
+ declare const date: typeof _dayjs;
58
+ declare function unixDate(t: number): _dayjs.Dayjs;
58
59
  declare function isDateExpired(start: number, end: number, expire: string): boolean;
59
60
  declare function unixDiff(start: number, end: number, unit?: QUnitType | OpUnitType): number;
60
61
  declare function datePeriod(start: number, value?: number, unit?: OpUnitType): number;
@@ -168,4 +169,4 @@ declare function slugify(text: string, options?: SlugifyOptions): string;
168
169
 
169
170
  declare function type(obj: any): string;
170
171
 
171
- export { FILE_MIME_TYPES, IMAGE_MIME_TYPES, RandomType, type SlugifyOptions, alpha, alphaHexToRgb, bytes, clone, colorBrightness, commonFileMimeTypes, commonImageMimeTypes, copyObjectValues, darken, date, datePeriod, excludeObject, formatBytes, _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 };
172
+ export { FILE_MIME_TYPES, IMAGE_MIME_TYPES, RandomType, type SlugifyOptions, alpha, alphaHexToRgb, bytes, clone, colorBrightness, commonFileMimeTypes, commonImageMimeTypes, copyObjectValues, darken, date, datePeriod, dayjs, excludeObject, formatBytes, _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 };
package/dist/index.js CHANGED
@@ -10,7 +10,7 @@ var _isURL = require('validator/lib/isURL');
10
10
  var _clone = require('clone');
11
11
  var htmlToText$1 = require('html-to-text');
12
12
  var _ms = require('ms');
13
- var dayjs = require('dayjs');
13
+ var _dayjs = require('dayjs');
14
14
  var nanoid$1 = require('nanoid');
15
15
  var objectPath = require('object-path');
16
16
  var fastEquals = require('fast-equals');
@@ -45,7 +45,7 @@ var _isEmail__default = /*#__PURE__*/_interopDefault(_isEmail);
45
45
  var _isURL__default = /*#__PURE__*/_interopDefault(_isURL);
46
46
  var _clone__default = /*#__PURE__*/_interopDefault(_clone);
47
47
  var _ms__default = /*#__PURE__*/_interopDefault(_ms);
48
- var dayjs__default = /*#__PURE__*/_interopDefault(dayjs);
48
+ var _dayjs__default = /*#__PURE__*/_interopDefault(_dayjs);
49
49
  var objectPath__namespace = /*#__PURE__*/_interopNamespace(objectPath);
50
50
  var slug__default = /*#__PURE__*/_interopDefault(slug);
51
51
 
@@ -551,11 +551,10 @@ var toMillisecond = ms;
551
551
  function timestamp() {
552
552
  return Math.floor(Date.now() / 1e3);
553
553
  }
554
- function date(str, format) {
555
- return dayjs__default.default(str, format);
556
- }
554
+ var dayjs = _dayjs__default.default;
555
+ var date = dayjs;
557
556
  function unixDate(t) {
558
- return dayjs__default.default.unix(t);
557
+ return date.unix(t);
559
558
  }
560
559
  function isDateExpired(start, end, expire) {
561
560
  return end - start > hs(expire);
@@ -1986,6 +1985,7 @@ exports.copyObjectValues = copyObjectValues;
1986
1985
  exports.darken = darken;
1987
1986
  exports.date = date;
1988
1987
  exports.datePeriod = datePeriod;
1988
+ exports.dayjs = dayjs;
1989
1989
  exports.excludeObject = excludeObject;
1990
1990
  exports.formatBytes = formatBytes;
1991
1991
  exports.helper = helper_default;