@heyform-inc/utils 1.2.2 → 1.3.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.
- package/dist/index.d.mts +7 -4
- package/dist/index.d.ts +7 -4
- package/dist/index.js +17 -11
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +14 -9
- package/dist/index.mjs.map +1 -1
- package/package.json +11 -18
package/dist/index.d.mts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
export * from 'deep-object-diff';
|
|
2
2
|
import { IParseOptions, IStringifyOptions } from 'qs';
|
|
3
3
|
export { default as qs } from 'qs';
|
|
4
|
-
import
|
|
5
|
-
import
|
|
4
|
+
import { ClassValue } from 'clsx';
|
|
5
|
+
import _dayjs, { OpUnitType, QUnitType } from 'dayjs';
|
|
6
|
+
import { IsEmailOptions } from 'validator/lib/isEmail';
|
|
6
7
|
import _isFQDN from 'validator/lib/isFQDN';
|
|
7
8
|
import { IsNumericOptions } from 'validator/lib/isNumeric';
|
|
8
|
-
import { IsEmailOptions } from 'validator/lib/isEmail';
|
|
9
9
|
import { IsURLOptions } from 'validator/lib/isURL';
|
|
10
|
+
import _isUUID from 'validator/lib/isUUID';
|
|
10
11
|
export { v4 as uuidv4, v5 as uuidv5 } from 'uuid';
|
|
11
12
|
export { deepEqual } from 'fast-equals';
|
|
12
13
|
|
|
@@ -16,6 +17,8 @@ declare function formatBytes(value: string | number): string;
|
|
|
16
17
|
|
|
17
18
|
declare function clone<T>(obj: T): T;
|
|
18
19
|
|
|
20
|
+
declare function clsx(...inputs: ClassValue[]): string;
|
|
21
|
+
|
|
19
22
|
declare function isHexColor(color: string): boolean;
|
|
20
23
|
declare function isRgba(color: string): boolean;
|
|
21
24
|
declare function isRgb(color: string): boolean;
|
|
@@ -169,4 +172,4 @@ declare function slugify(text: string, options?: SlugifyOptions): string;
|
|
|
169
172
|
|
|
170
173
|
declare function type(obj: any): string;
|
|
171
174
|
|
|
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 };
|
|
175
|
+
export { FILE_MIME_TYPES, IMAGE_MIME_TYPES, RandomType, type SlugifyOptions, alpha, alphaHexToRgb, bytes, clone, clsx, 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,12 +1,13 @@
|
|
|
1
1
|
export * from 'deep-object-diff';
|
|
2
2
|
import { IParseOptions, IStringifyOptions } from 'qs';
|
|
3
3
|
export { default as qs } from 'qs';
|
|
4
|
-
import
|
|
5
|
-
import
|
|
4
|
+
import { ClassValue } from 'clsx';
|
|
5
|
+
import _dayjs, { OpUnitType, QUnitType } from 'dayjs';
|
|
6
|
+
import { IsEmailOptions } from 'validator/lib/isEmail';
|
|
6
7
|
import _isFQDN from 'validator/lib/isFQDN';
|
|
7
8
|
import { IsNumericOptions } from 'validator/lib/isNumeric';
|
|
8
|
-
import { IsEmailOptions } from 'validator/lib/isEmail';
|
|
9
9
|
import { IsURLOptions } from 'validator/lib/isURL';
|
|
10
|
+
import _isUUID from 'validator/lib/isUUID';
|
|
10
11
|
export { v4 as uuidv4, v5 as uuidv5 } from 'uuid';
|
|
11
12
|
export { deepEqual } from 'fast-equals';
|
|
12
13
|
|
|
@@ -16,6 +17,8 @@ declare function formatBytes(value: string | number): string;
|
|
|
16
17
|
|
|
17
18
|
declare function clone<T>(obj: T): T;
|
|
18
19
|
|
|
20
|
+
declare function clsx(...inputs: ClassValue[]): string;
|
|
21
|
+
|
|
19
22
|
declare function isHexColor(color: string): boolean;
|
|
20
23
|
declare function isRgba(color: string): boolean;
|
|
21
24
|
declare function isRgb(color: string): boolean;
|
|
@@ -169,4 +172,4 @@ declare function slugify(text: string, options?: SlugifyOptions): string;
|
|
|
169
172
|
|
|
170
173
|
declare function type(obj: any): string;
|
|
171
174
|
|
|
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 };
|
|
175
|
+
export { FILE_MIME_TYPES, IMAGE_MIME_TYPES, RandomType, type SlugifyOptions, alpha, alphaHexToRgb, bytes, clone, clsx, 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
|
@@ -2,15 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
var deepObjectDiff = require('deep-object-diff');
|
|
4
4
|
var qs = require('qs');
|
|
5
|
-
var
|
|
5
|
+
var _isEmail = require('validator/lib/isEmail');
|
|
6
6
|
var _isFQDN = require('validator/lib/isFQDN');
|
|
7
7
|
var _isNumeric = require('validator/lib/isNumeric');
|
|
8
|
-
var _isEmail = require('validator/lib/isEmail');
|
|
9
8
|
var _isURL = require('validator/lib/isURL');
|
|
9
|
+
var _isUUID = require('validator/lib/isUUID');
|
|
10
10
|
var _clone = require('clone');
|
|
11
|
+
var clsx$1 = require('clsx');
|
|
12
|
+
var tailwindMerge = require('tailwind-merge');
|
|
11
13
|
var htmlToText$1 = require('html-to-text');
|
|
12
|
-
var _ms = require('ms');
|
|
13
14
|
var _dayjs = require('dayjs');
|
|
15
|
+
var _ms = require('ms');
|
|
14
16
|
var nanoid$1 = require('nanoid');
|
|
15
17
|
var objectPath = require('object-path');
|
|
16
18
|
var fastEquals = require('fast-equals');
|
|
@@ -38,14 +40,14 @@ function _interopNamespace(e) {
|
|
|
38
40
|
}
|
|
39
41
|
|
|
40
42
|
var qs__default = /*#__PURE__*/_interopDefault(qs);
|
|
41
|
-
var
|
|
43
|
+
var _isEmail__default = /*#__PURE__*/_interopDefault(_isEmail);
|
|
42
44
|
var _isFQDN__default = /*#__PURE__*/_interopDefault(_isFQDN);
|
|
43
45
|
var _isNumeric__default = /*#__PURE__*/_interopDefault(_isNumeric);
|
|
44
|
-
var _isEmail__default = /*#__PURE__*/_interopDefault(_isEmail);
|
|
45
46
|
var _isURL__default = /*#__PURE__*/_interopDefault(_isURL);
|
|
47
|
+
var _isUUID__default = /*#__PURE__*/_interopDefault(_isUUID);
|
|
46
48
|
var _clone__default = /*#__PURE__*/_interopDefault(_clone);
|
|
47
|
-
var _ms__default = /*#__PURE__*/_interopDefault(_ms);
|
|
48
49
|
var _dayjs__default = /*#__PURE__*/_interopDefault(_dayjs);
|
|
50
|
+
var _ms__default = /*#__PURE__*/_interopDefault(_ms);
|
|
49
51
|
var objectPath__namespace = /*#__PURE__*/_interopNamespace(objectPath);
|
|
50
52
|
var slug__default = /*#__PURE__*/_interopDefault(slug);
|
|
51
53
|
|
|
@@ -303,6 +305,9 @@ function formatBytes(value) {
|
|
|
303
305
|
function clone(obj) {
|
|
304
306
|
return _clone__default.default(obj);
|
|
305
307
|
}
|
|
308
|
+
function clsx(...inputs) {
|
|
309
|
+
return tailwindMerge.twMerge(clsx$1.clsx(inputs));
|
|
310
|
+
}
|
|
306
311
|
|
|
307
312
|
// src/color.ts
|
|
308
313
|
var HEX_REGEX = /^#?([0-9A-F]{3}|[0-9A-F]{4}|[0-9A-F]{6}|[0-9A-F]{8})$/i;
|
|
@@ -382,9 +387,7 @@ function alphaHexToRgb(hex, alpha2, backgroundHex) {
|
|
|
382
387
|
const backgroundRgb = hexToRgb(backgroundHex);
|
|
383
388
|
return hexRgb.map((color, index) => {
|
|
384
389
|
return colorRange(
|
|
385
|
-
Math.floor(
|
|
386
|
-
colorRange(color) * alpha2 + colorRange(backgroundRgb[index]) * (1 - alpha2)
|
|
387
|
-
)
|
|
390
|
+
Math.floor(colorRange(color) * alpha2 + colorRange(backgroundRgb[index]) * (1 - alpha2))
|
|
388
391
|
);
|
|
389
392
|
});
|
|
390
393
|
}
|
|
@@ -548,13 +551,15 @@ function ms(arg) {
|
|
|
548
551
|
}
|
|
549
552
|
var toSecond = hs;
|
|
550
553
|
var toMillisecond = ms;
|
|
554
|
+
|
|
555
|
+
// src/date.ts
|
|
551
556
|
function timestamp() {
|
|
552
557
|
return Math.floor(Date.now() / 1e3);
|
|
553
558
|
}
|
|
554
559
|
var dayjs = _dayjs__default.default;
|
|
555
560
|
var date = dayjs;
|
|
556
561
|
function unixDate(t) {
|
|
557
|
-
return
|
|
562
|
+
return dayjs.unix(t);
|
|
558
563
|
}
|
|
559
564
|
function isDateExpired(start, end, expire) {
|
|
560
565
|
return end - start > hs(expire);
|
|
@@ -1978,6 +1983,7 @@ exports.alpha = alpha;
|
|
|
1978
1983
|
exports.alphaHexToRgb = alphaHexToRgb;
|
|
1979
1984
|
exports.bytes = bytes;
|
|
1980
1985
|
exports.clone = clone;
|
|
1986
|
+
exports.clsx = clsx;
|
|
1981
1987
|
exports.colorBrightness = colorBrightness;
|
|
1982
1988
|
exports.commonFileMimeTypes = commonFileMimeTypes;
|
|
1983
1989
|
exports.commonImageMimeTypes = commonImageMimeTypes;
|
|
@@ -2036,5 +2042,5 @@ Object.keys(deepObjectDiff).forEach(function (k) {
|
|
|
2036
2042
|
get: function () { return deepObjectDiff[k]; }
|
|
2037
2043
|
});
|
|
2038
2044
|
});
|
|
2039
|
-
//# sourceMappingURL=
|
|
2045
|
+
//# sourceMappingURL=index.js.map
|
|
2040
2046
|
//# sourceMappingURL=index.js.map
|