@hairy/utils 1.0.14

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/LICENSE ADDED
@@ -0,0 +1,23 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2019-PRESENT Anthony Fu<https://github.com/TuiMao233>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
23
+
package/index.cjs.js ADDED
@@ -0,0 +1,218 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var dayjs = require('dayjs');
6
+ var lodash = require('lodash');
7
+
8
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
9
+
10
+ var dayjs__default = /*#__PURE__*/_interopDefaultLegacy(dayjs);
11
+
12
+ const blendColor = (colorOne, colorTwo, ratio) => {
13
+ ratio = Math.max(Math.min(Number(ratio), 1), 0);
14
+ const r1 = parseInt(colorOne.slice(1, 3), 16);
15
+ const g1 = parseInt(colorOne.slice(3, 5), 16);
16
+ const b1 = parseInt(colorOne.slice(5, 7), 16);
17
+ const r2 = parseInt(colorTwo.slice(1, 3), 16);
18
+ const g2 = parseInt(colorTwo.slice(3, 5), 16);
19
+ const b2 = parseInt(colorTwo.slice(5, 7), 16);
20
+ let r = Math.round(r1 * (1 - ratio) + r2 * ratio);
21
+ let g = Math.round(g1 * (1 - ratio) + g2 * ratio);
22
+ let b = Math.round(b1 * (1 - ratio) + b2 * ratio);
23
+ r = ("0" + (r || 0).toString(16)).slice(-2);
24
+ g = ("0" + (g || 0).toString(16)).slice(-2);
25
+ b = ("0" + (b || 0).toString(16)).slice(-2);
26
+ return "#" + r + g + b;
27
+ };
28
+ const hexToRgba = (hex, opacity) => {
29
+ const RGBA = "rgba(" + parseInt("0x" + hex.slice(1, 3)) + "," + parseInt("0x" + hex.slice(3, 5)) + "," + parseInt("0x" + hex.slice(5, 7)) + "," + opacity + ")";
30
+ return {
31
+ red: parseInt("0x" + hex.slice(1, 3)),
32
+ green: parseInt("0x" + hex.slice(3, 5)),
33
+ blue: parseInt("0x" + hex.slice(5, 7)),
34
+ rgba: RGBA
35
+ };
36
+ };
37
+ const fuseThemeColor = (color) => ({
38
+ "primaryColorLight-2": blendColor("#ffffff", color, 0.8),
39
+ "primaryColorLight-4": blendColor("#ffffff", color, 0.6),
40
+ "primaryColorLight-6": blendColor("#ffffff", color, 0.4),
41
+ "primaryColorLight-8": blendColor("#ffffff", color, 0.2),
42
+ "primaryColorDark-2": blendColor("#000000", color, 0.8),
43
+ "primaryColorDark-4": blendColor("#000000", color, 0.6),
44
+ "primaryColorDark-6": blendColor("#000000", color, 0.4),
45
+ "primaryColorDark-8": blendColor("#000000", color, 0.2),
46
+ "primaryColorOpacity-2": hexToRgba(color, 0.8).rgba,
47
+ "primaryColorOpacity-4": hexToRgba(color, 0.6).rgba,
48
+ "primaryColorOpacity-6": hexToRgba(color, 0.4).rgba,
49
+ "primaryColorOpacity-8": hexToRgba(color, 0.2).rgba
50
+ });
51
+
52
+ const formatClearHtml = (string_) => string_.replace(/<[!/]*[^<>]*>/gi, "");
53
+ const formatPrice = (value) => {
54
+ return value.replace(/^[^\d+]/, "").replace(/[^\d,.{|}]/g, "").replace(".", "$#$").replace(/\./g, "").replace("$#$", ".").replace(/\.{2,}/g, ".").replace(/^(-)*(\d+)\.(\d\d).*$/, "$1$2.$3");
55
+ };
56
+ const formatInteger = (value) => {
57
+ return value.replace(/^(0+)|\D+/g, "");
58
+ };
59
+ const formatThousandBitSeparator = (target, unit = ",") => {
60
+ if (target === "")
61
+ return "";
62
+ const part = String(target).split(".");
63
+ for (let index = 0; index < part.length; index++) {
64
+ part[index] = part[index].replace(new RegExp("(\\d)(?=(\\d{3})+$)", "ig"), `$1${unit || ""}`);
65
+ }
66
+ return part.join(".");
67
+ };
68
+ const formatUnix = (timestamp, format = "YYYY-MM-DD HH:mm:ss") => {
69
+ return dayjs__default["default"].unix(timestamp).format(format);
70
+ };
71
+ const formatCoverPhone = (phone) => {
72
+ return phone.replace(/^(\d{3})\d{4}(\d{4})$/, "$1****$2");
73
+ };
74
+ const prefixZero = (number_, lh = 2) => {
75
+ return (new Array(lh).join("0") + number_).slice(-lh);
76
+ };
77
+ const capitalizeCamelCase = (string_) => {
78
+ let result = lodash.camelCase(string_);
79
+ result = result.slice(0, 1).toLocaleUpperCase() + result.slice(1);
80
+ return result;
81
+ };
82
+
83
+ const isBrowser = typeof window !== "undefined";
84
+ const isWeex = typeof WXEnvironment !== "undefined" && !!WXEnvironment.platform;
85
+ const weexPlatform = isWeex && WXEnvironment.platform.toLowerCase();
86
+ const UA = isBrowser && window.navigator.userAgent.toLowerCase();
87
+ const isIE = UA && /msie|trident/.test(UA);
88
+ const isIE9 = UA && UA.indexOf("msie 9.0") > 0;
89
+ const isIE11 = navigator.userAgent.includes("Trident") && navigator.userAgent.includes("rv:11.0");
90
+ const isEdge = UA && UA.indexOf("edge/") > 0;
91
+ const isAndroid = UA && UA.indexOf("android") > 0 || weexPlatform === "android";
92
+ const isIOS = UA && /iphone|ipad|ipod|ios/.test(UA) || weexPlatform === "ios";
93
+ const isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
94
+ const isPhantomJS = UA && /phantomjs/.test(UA);
95
+ const isFF = typeof UA == "string" && UA.match(/firefox\/(\d+)/);
96
+ const isMobile = navigator.userAgent.toLowerCase().includes("mobile");
97
+
98
+ const analyUnit = (size, unit = "px") => {
99
+ return lodash.isString(size) && /\D/g.test(size) ? size : size + unit;
100
+ };
101
+ const analySize = (size, unit) => {
102
+ if (typeof size === "string" || typeof size === "number") {
103
+ return { width: analyUnit(size, unit), height: analyUnit(size, unit) };
104
+ }
105
+ if (Array.isArray(size)) {
106
+ return { width: analyUnit(size[0], unit), height: analyUnit(size[1], unit) };
107
+ }
108
+ if (typeof size === "object") {
109
+ return { width: analyUnit(size.width, unit), height: analyUnit(size.height, unit) };
110
+ }
111
+ return { width: "", height: "" };
112
+ };
113
+
114
+ const checkedTypeof = (target) => {
115
+ return Object.prototype.toString.call(target).slice(8, -1);
116
+ };
117
+ const assert = (condition, ...infos) => {
118
+ if (!condition)
119
+ console.warn(...infos);
120
+ return condition;
121
+ };
122
+ const isClient = typeof window !== "undefined";
123
+ const isFormData = (value) => lodash.isObject(value) && value instanceof FormData;
124
+ const isWindow = (value) => typeof window !== "undefined" && toString.call(value) === "[object Window]";
125
+
126
+ const urlParamsAnaly = (url, params) => {
127
+ const queryString = Object.keys(params).map((key) => `${key}=${params[key]}`);
128
+ if (queryString.length > 0)
129
+ url += "?" + queryString.join("&");
130
+ return url;
131
+ };
132
+ const awaitPromise = (code = 1e3) => {
133
+ return new Promise((resolve) => setTimeout(resolve, code));
134
+ };
135
+ const generateArray = (start, end) => {
136
+ start = Number(start);
137
+ end = Number(end);
138
+ end = end > start ? end : start;
139
+ return [...new Array(end + 1).keys()].slice(start);
140
+ };
141
+ const pickByParams = (params, filters, deep = false) => {
142
+ deep && lodash.forIn(params, (value, key) => {
143
+ if (lodash.isObject(value))
144
+ params[key] = pickByParams(params[key], filters, deep);
145
+ });
146
+ const pickValue = lodash.pickBy(params, (value) => !filters.includes(value));
147
+ if (Array.isArray(params)) {
148
+ return Object.values(pickValue);
149
+ }
150
+ return pickValue;
151
+ };
152
+ const formDataToObject = (formData) => {
153
+ return Object.fromEntries(formData.entries());
154
+ };
155
+ const objectToFormData = (object) => {
156
+ const formData = new FormData();
157
+ for (const [key, value] of Object.entries(object)) {
158
+ formData.append(key, value);
159
+ }
160
+ return formData;
161
+ };
162
+ const objectFlat = (object, deep = 1) => {
163
+ const flatDeep = (object2, deep2 = 1) => {
164
+ let _object = {};
165
+ for (const [key, value] of Object.entries(object2)) {
166
+ if (lodash.isPlainObject(value)) {
167
+ _object = { ..._object, ...deep2 > 0 ? flatDeep(value, deep2 - 1) : value };
168
+ continue;
169
+ }
170
+ _object[key] = value;
171
+ }
172
+ return _object;
173
+ };
174
+ return flatDeep(object, deep);
175
+ };
176
+ const noop = () => {
177
+ };
178
+
179
+ exports.UA = UA;
180
+ exports.analySize = analySize;
181
+ exports.analyUnit = analyUnit;
182
+ exports.assert = assert;
183
+ exports.awaitPromise = awaitPromise;
184
+ exports.blendColor = blendColor;
185
+ exports.capitalizeCamelCase = capitalizeCamelCase;
186
+ exports.checkedTypeof = checkedTypeof;
187
+ exports.formDataToObject = formDataToObject;
188
+ exports.formatClearHtml = formatClearHtml;
189
+ exports.formatCoverPhone = formatCoverPhone;
190
+ exports.formatInteger = formatInteger;
191
+ exports.formatPrice = formatPrice;
192
+ exports.formatThousandBitSeparator = formatThousandBitSeparator;
193
+ exports.formatUnix = formatUnix;
194
+ exports.fuseThemeColor = fuseThemeColor;
195
+ exports.generateArray = generateArray;
196
+ exports.hexToRgba = hexToRgba;
197
+ exports.isAndroid = isAndroid;
198
+ exports.isBrowser = isBrowser;
199
+ exports.isChrome = isChrome;
200
+ exports.isClient = isClient;
201
+ exports.isEdge = isEdge;
202
+ exports.isFF = isFF;
203
+ exports.isFormData = isFormData;
204
+ exports.isIE = isIE;
205
+ exports.isIE11 = isIE11;
206
+ exports.isIE9 = isIE9;
207
+ exports.isIOS = isIOS;
208
+ exports.isMobile = isMobile;
209
+ exports.isPhantomJS = isPhantomJS;
210
+ exports.isWeex = isWeex;
211
+ exports.isWindow = isWindow;
212
+ exports.noop = noop;
213
+ exports.objectFlat = objectFlat;
214
+ exports.objectToFormData = objectToFormData;
215
+ exports.pickByParams = pickByParams;
216
+ exports.prefixZero = prefixZero;
217
+ exports.urlParamsAnaly = urlParamsAnaly;
218
+ exports.weexPlatform = weexPlatform;
package/index.d.ts ADDED
@@ -0,0 +1,210 @@
1
+ import { LooseNumber as LooseNumber$1 } from '@hairy/utils';
2
+
3
+ /**
4
+ * 颜色混合器
5
+ * @param colorOne 颜色值
6
+ * @param colorTwo 颜色值
7
+ * @param ratio 根据 colorTwo 混合比例, 0~1 区间, 1 则是完全的 colorTwo
8
+ * @returns 混合颜色
9
+ */
10
+ declare const blendColor: (colorOne: string, colorTwo: string, ratio: number) => string;
11
+ /**
12
+ * 将 hex 颜色转成 rgb
13
+ * @param hex
14
+ * @param opacity
15
+ * @returns rgba String
16
+ */
17
+ declare const hexToRgba: (hex: string, opacity: number) => {
18
+ red: number;
19
+ green: number;
20
+ blue: number;
21
+ rgba: string;
22
+ };
23
+ /**
24
+ * 根据颜色融合出黑色与白色, 透明度色
25
+ * @param color
26
+ */
27
+ declare const fuseThemeColor: (color: string) => {
28
+ 'primaryColorLight-2': string;
29
+ 'primaryColorLight-4': string;
30
+ 'primaryColorLight-6': string;
31
+ 'primaryColorLight-8': string;
32
+ 'primaryColorDark-2': string;
33
+ 'primaryColorDark-4': string;
34
+ 'primaryColorDark-6': string;
35
+ 'primaryColorDark-8': string;
36
+ 'primaryColorOpacity-2': string;
37
+ 'primaryColorOpacity-4': string;
38
+ 'primaryColorOpacity-6': string;
39
+ 'primaryColorOpacity-8': string;
40
+ };
41
+
42
+ /**
43
+ * 格式化剔除字符串代码字段
44
+ * @param str 字符串
45
+ * @returns 剔除字符串
46
+ */
47
+ declare const formatClearHtml: (string_: string) => string;
48
+ /**
49
+ * 格式化为价格(两位小数点)
50
+ * @param value 传入字符
51
+ */
52
+ declare const formatPrice: (value: string) => string;
53
+ /**
54
+ * 格式化为正整数
55
+ * @param value 传入字符
56
+ */
57
+ declare const formatInteger: (value: string) => string;
58
+ /**
59
+ * 格式化数字千位分隔符
60
+ * @param number_ 数值
61
+ * @param unit 单位
62
+ */
63
+ declare const formatThousandBitSeparator: (target: number | string, unit?: string) => string;
64
+ /**
65
+ * 时间戳格式化(秒)
66
+ * @param timestamp 格式化时间戳(秒)
67
+ * @param format 格式化时间格式
68
+ * @returns 格式时间字符串
69
+ */
70
+ declare const formatUnix: (timestamp: number, format?: string) => string;
71
+ /**
72
+ * 隐藏手机号中间四位
73
+ */
74
+ declare const formatCoverPhone: (phone: string) => string;
75
+ /**
76
+ * 数字位数不够,进行前补零
77
+ * @param num 数值
78
+ * @param lh 长度
79
+ */
80
+ declare const prefixZero: (number_: number, lh?: number) => string;
81
+ /**
82
+ * 转换大写驼峰
83
+ * @param str
84
+ */
85
+ declare const capitalizeCamelCase: (string_: string) => string;
86
+
87
+ declare const isBrowser: boolean;
88
+ declare const isWeex: boolean;
89
+ declare const weexPlatform: any;
90
+ declare const UA: string | false;
91
+ declare const isIE: boolean | "";
92
+ declare const isIE9: boolean | "";
93
+ declare const isIE11: boolean;
94
+ declare const isEdge: boolean | "";
95
+ declare const isAndroid: boolean;
96
+ declare const isIOS: boolean;
97
+ declare const isChrome: boolean | "";
98
+ declare const isPhantomJS: boolean | "";
99
+ declare const isFF: false | RegExpMatchArray | null;
100
+ declare const isMobile: boolean;
101
+
102
+ /**
103
+ * 如果有单位,如百分比,px单位等,直接返回,如果是纯粹的数值,则加上px单位
104
+ * @param size 尺寸
105
+ * @param unit 单元
106
+ * @returns string
107
+ */
108
+ declare const analyUnit: (size: LooseNumber$1, unit?: string) => string;
109
+ /** size 转换配置 */
110
+ declare type AnalySizeOption = LooseNumber$1 | [LooseNumber$1, LooseNumber$1] | {
111
+ width: LooseNumber$1;
112
+ height: LooseNumber$1;
113
+ };
114
+ /**
115
+ * 将 size 转换为宽高
116
+ * @param size { AnalySizeOption }
117
+ * @returns
118
+ */
119
+ declare const analySize: (size: AnalySizeOption, unit?: string | undefined) => {
120
+ width: string;
121
+ height: string;
122
+ };
123
+
124
+ declare type PlainObject = {
125
+ [key: string]: any;
126
+ };
127
+ declare type LooseNumber = string | number;
128
+ declare type Key = string | number | symbol;
129
+ declare type DeepReadonly<T> = {
130
+ readonly [P in keyof T]: T[P] extends object ? DeepReadonly<T[P]> : T[P];
131
+ };
132
+ declare type DeepRequired<T> = {
133
+ [P in keyof T]-?: T[P] extends object ? DeepRequired<T[P]> : T[P];
134
+ };
135
+ declare type DeepPartial<T> = {
136
+ [P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
137
+ };
138
+ declare type DeepKeyof<T> = T extends object ? keyof T | DeepKeyof<T[keyof T]> : never;
139
+ declare type DeepReplace<T, K = unknown, V = unknown> = {
140
+ [P in keyof T]: K extends P ? V : DeepReplace<T[P], K, V>;
141
+ };
142
+ declare type Option<L extends Key = 'label', V extends Key = 'value', C extends Key = 'children'> = {
143
+ [P in L]: LooseNumber;
144
+ } & {
145
+ [P in V]: LooseNumber;
146
+ } & {
147
+ [P in C]: Option[];
148
+ };
149
+
150
+ /**
151
+ * 获取数据类型
152
+ * @param target 检测对象
153
+ * @returns 返回字符串
154
+ */
155
+ declare const checkedTypeof: (target: any) => string;
156
+ /**
157
+ * 不符合预期则弹出警告
158
+ * @param condition
159
+ * @param infos
160
+ */
161
+ declare const assert: (condition: boolean, ...infos: any[]) => boolean;
162
+ declare const isClient: boolean;
163
+ declare const isFormData: (value: any) => value is FormData;
164
+ declare const isWindow: (value: any) => value is Window;
165
+
166
+ /**
167
+ * 地址参数计算
168
+ * @param url 传入url
169
+ * @param params 请求参数
170
+ * @returns 拼接url
171
+ */
172
+ declare const urlParamsAnaly: (url: string, params: Record<string, any>) => string;
173
+ /**
174
+ * 自定义 Promise 等待
175
+ * @param code 等待时间
176
+ */
177
+ declare const awaitPromise: (code?: number) => Promise<unknown>;
178
+ /**
179
+ * 生成递进的数组
180
+ * @param start 开始数值
181
+ * @param end 结束数值
182
+ * @returns 递进的数组
183
+ */
184
+ declare const generateArray: (start: number, end: number) => number[];
185
+ /**
186
+ * 根据过滤返回对应数据
187
+ * @param params
188
+ * @param filters
189
+ */
190
+ declare const pickByParams: <T extends object>(params: T, filters: any[], deep?: boolean) => Partial<T>;
191
+ /**
192
+ * 将 formData 转换为 ojbect
193
+ * @param formData
194
+ */
195
+ declare const formDataToObject: (formData: FormData) => Record<string, string>;
196
+ /**
197
+ * 将 object 转换为 formData
198
+ * @param object
199
+ */
200
+ declare const objectToFormData: (object: Record<string, string>) => FormData;
201
+ /**
202
+ * 对象扁平化处理
203
+ * @param object 对象
204
+ * @param deep 深度
205
+ */
206
+ declare const objectFlat: (object: Record<string, any>, deep?: number) => Record<string, any>;
207
+ /** 空的方法 */
208
+ declare const noop: () => void;
209
+
210
+ export { AnalySizeOption, DeepKeyof, DeepPartial, DeepReadonly, DeepReplace, DeepRequired, Key, LooseNumber, Option, PlainObject, UA, analySize, analyUnit, assert, awaitPromise, blendColor, capitalizeCamelCase, checkedTypeof, formDataToObject, formatClearHtml, formatCoverPhone, formatInteger, formatPrice, formatThousandBitSeparator, formatUnix, fuseThemeColor, generateArray, hexToRgba, isAndroid, isBrowser, isChrome, isClient, isEdge, isFF, isFormData, isIE, isIE11, isIE9, isIOS, isMobile, isPhantomJS, isWeex, isWindow, noop, objectFlat, objectToFormData, pickByParams, prefixZero, urlParamsAnaly, weexPlatform };
package/index.esm.js ADDED
@@ -0,0 +1,171 @@
1
+ import dayjs from 'dayjs';
2
+ import { camelCase, isString, isObject, forIn, pickBy, isPlainObject } from 'lodash';
3
+
4
+ const blendColor = (colorOne, colorTwo, ratio) => {
5
+ ratio = Math.max(Math.min(Number(ratio), 1), 0);
6
+ const r1 = parseInt(colorOne.slice(1, 3), 16);
7
+ const g1 = parseInt(colorOne.slice(3, 5), 16);
8
+ const b1 = parseInt(colorOne.slice(5, 7), 16);
9
+ const r2 = parseInt(colorTwo.slice(1, 3), 16);
10
+ const g2 = parseInt(colorTwo.slice(3, 5), 16);
11
+ const b2 = parseInt(colorTwo.slice(5, 7), 16);
12
+ let r = Math.round(r1 * (1 - ratio) + r2 * ratio);
13
+ let g = Math.round(g1 * (1 - ratio) + g2 * ratio);
14
+ let b = Math.round(b1 * (1 - ratio) + b2 * ratio);
15
+ r = ("0" + (r || 0).toString(16)).slice(-2);
16
+ g = ("0" + (g || 0).toString(16)).slice(-2);
17
+ b = ("0" + (b || 0).toString(16)).slice(-2);
18
+ return "#" + r + g + b;
19
+ };
20
+ const hexToRgba = (hex, opacity) => {
21
+ const RGBA = "rgba(" + parseInt("0x" + hex.slice(1, 3)) + "," + parseInt("0x" + hex.slice(3, 5)) + "," + parseInt("0x" + hex.slice(5, 7)) + "," + opacity + ")";
22
+ return {
23
+ red: parseInt("0x" + hex.slice(1, 3)),
24
+ green: parseInt("0x" + hex.slice(3, 5)),
25
+ blue: parseInt("0x" + hex.slice(5, 7)),
26
+ rgba: RGBA
27
+ };
28
+ };
29
+ const fuseThemeColor = (color) => ({
30
+ "primaryColorLight-2": blendColor("#ffffff", color, 0.8),
31
+ "primaryColorLight-4": blendColor("#ffffff", color, 0.6),
32
+ "primaryColorLight-6": blendColor("#ffffff", color, 0.4),
33
+ "primaryColorLight-8": blendColor("#ffffff", color, 0.2),
34
+ "primaryColorDark-2": blendColor("#000000", color, 0.8),
35
+ "primaryColorDark-4": blendColor("#000000", color, 0.6),
36
+ "primaryColorDark-6": blendColor("#000000", color, 0.4),
37
+ "primaryColorDark-8": blendColor("#000000", color, 0.2),
38
+ "primaryColorOpacity-2": hexToRgba(color, 0.8).rgba,
39
+ "primaryColorOpacity-4": hexToRgba(color, 0.6).rgba,
40
+ "primaryColorOpacity-6": hexToRgba(color, 0.4).rgba,
41
+ "primaryColorOpacity-8": hexToRgba(color, 0.2).rgba
42
+ });
43
+
44
+ const formatClearHtml = (string_) => string_.replace(/<[!/]*[^<>]*>/gi, "");
45
+ const formatPrice = (value) => {
46
+ return value.replace(/^[^\d+]/, "").replace(/[^\d,.{|}]/g, "").replace(".", "$#$").replace(/\./g, "").replace("$#$", ".").replace(/\.{2,}/g, ".").replace(/^(-)*(\d+)\.(\d\d).*$/, "$1$2.$3");
47
+ };
48
+ const formatInteger = (value) => {
49
+ return value.replace(/^(0+)|\D+/g, "");
50
+ };
51
+ const formatThousandBitSeparator = (target, unit = ",") => {
52
+ if (target === "")
53
+ return "";
54
+ const part = String(target).split(".");
55
+ for (let index = 0; index < part.length; index++) {
56
+ part[index] = part[index].replace(new RegExp("(\\d)(?=(\\d{3})+$)", "ig"), `$1${unit || ""}`);
57
+ }
58
+ return part.join(".");
59
+ };
60
+ const formatUnix = (timestamp, format = "YYYY-MM-DD HH:mm:ss") => {
61
+ return dayjs.unix(timestamp).format(format);
62
+ };
63
+ const formatCoverPhone = (phone) => {
64
+ return phone.replace(/^(\d{3})\d{4}(\d{4})$/, "$1****$2");
65
+ };
66
+ const prefixZero = (number_, lh = 2) => {
67
+ return (new Array(lh).join("0") + number_).slice(-lh);
68
+ };
69
+ const capitalizeCamelCase = (string_) => {
70
+ let result = camelCase(string_);
71
+ result = result.slice(0, 1).toLocaleUpperCase() + result.slice(1);
72
+ return result;
73
+ };
74
+
75
+ const isBrowser = typeof window !== "undefined";
76
+ const isWeex = typeof WXEnvironment !== "undefined" && !!WXEnvironment.platform;
77
+ const weexPlatform = isWeex && WXEnvironment.platform.toLowerCase();
78
+ const UA = isBrowser && window.navigator.userAgent.toLowerCase();
79
+ const isIE = UA && /msie|trident/.test(UA);
80
+ const isIE9 = UA && UA.indexOf("msie 9.0") > 0;
81
+ const isIE11 = navigator.userAgent.includes("Trident") && navigator.userAgent.includes("rv:11.0");
82
+ const isEdge = UA && UA.indexOf("edge/") > 0;
83
+ const isAndroid = UA && UA.indexOf("android") > 0 || weexPlatform === "android";
84
+ const isIOS = UA && /iphone|ipad|ipod|ios/.test(UA) || weexPlatform === "ios";
85
+ const isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
86
+ const isPhantomJS = UA && /phantomjs/.test(UA);
87
+ const isFF = typeof UA == "string" && UA.match(/firefox\/(\d+)/);
88
+ const isMobile = navigator.userAgent.toLowerCase().includes("mobile");
89
+
90
+ const analyUnit = (size, unit = "px") => {
91
+ return isString(size) && /\D/g.test(size) ? size : size + unit;
92
+ };
93
+ const analySize = (size, unit) => {
94
+ if (typeof size === "string" || typeof size === "number") {
95
+ return { width: analyUnit(size, unit), height: analyUnit(size, unit) };
96
+ }
97
+ if (Array.isArray(size)) {
98
+ return { width: analyUnit(size[0], unit), height: analyUnit(size[1], unit) };
99
+ }
100
+ if (typeof size === "object") {
101
+ return { width: analyUnit(size.width, unit), height: analyUnit(size.height, unit) };
102
+ }
103
+ return { width: "", height: "" };
104
+ };
105
+
106
+ const checkedTypeof = (target) => {
107
+ return Object.prototype.toString.call(target).slice(8, -1);
108
+ };
109
+ const assert = (condition, ...infos) => {
110
+ if (!condition)
111
+ console.warn(...infos);
112
+ return condition;
113
+ };
114
+ const isClient = typeof window !== "undefined";
115
+ const isFormData = (value) => isObject(value) && value instanceof FormData;
116
+ const isWindow = (value) => typeof window !== "undefined" && toString.call(value) === "[object Window]";
117
+
118
+ const urlParamsAnaly = (url, params) => {
119
+ const queryString = Object.keys(params).map((key) => `${key}=${params[key]}`);
120
+ if (queryString.length > 0)
121
+ url += "?" + queryString.join("&");
122
+ return url;
123
+ };
124
+ const awaitPromise = (code = 1e3) => {
125
+ return new Promise((resolve) => setTimeout(resolve, code));
126
+ };
127
+ const generateArray = (start, end) => {
128
+ start = Number(start);
129
+ end = Number(end);
130
+ end = end > start ? end : start;
131
+ return [...new Array(end + 1).keys()].slice(start);
132
+ };
133
+ const pickByParams = (params, filters, deep = false) => {
134
+ deep && forIn(params, (value, key) => {
135
+ if (isObject(value))
136
+ params[key] = pickByParams(params[key], filters, deep);
137
+ });
138
+ const pickValue = pickBy(params, (value) => !filters.includes(value));
139
+ if (Array.isArray(params)) {
140
+ return Object.values(pickValue);
141
+ }
142
+ return pickValue;
143
+ };
144
+ const formDataToObject = (formData) => {
145
+ return Object.fromEntries(formData.entries());
146
+ };
147
+ const objectToFormData = (object) => {
148
+ const formData = new FormData();
149
+ for (const [key, value] of Object.entries(object)) {
150
+ formData.append(key, value);
151
+ }
152
+ return formData;
153
+ };
154
+ const objectFlat = (object, deep = 1) => {
155
+ const flatDeep = (object2, deep2 = 1) => {
156
+ let _object = {};
157
+ for (const [key, value] of Object.entries(object2)) {
158
+ if (isPlainObject(value)) {
159
+ _object = { ..._object, ...deep2 > 0 ? flatDeep(value, deep2 - 1) : value };
160
+ continue;
161
+ }
162
+ _object[key] = value;
163
+ }
164
+ return _object;
165
+ };
166
+ return flatDeep(object, deep);
167
+ };
168
+ const noop = () => {
169
+ };
170
+
171
+ export { UA, analySize, analyUnit, assert, awaitPromise, blendColor, capitalizeCamelCase, checkedTypeof, formDataToObject, formatClearHtml, formatCoverPhone, formatInteger, formatPrice, formatThousandBitSeparator, formatUnix, fuseThemeColor, generateArray, hexToRgba, isAndroid, isBrowser, isChrome, isClient, isEdge, isFF, isFormData, isIE, isIE11, isIE9, isIOS, isMobile, isPhantomJS, isWeex, isWindow, noop, objectFlat, objectToFormData, pickByParams, prefixZero, urlParamsAnaly, weexPlatform };
package/index.iife.js ADDED
@@ -0,0 +1,218 @@
1
+ (function (exports, dayjs, lodash) {
2
+ 'use strict';
3
+
4
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
5
+
6
+ var dayjs__default = /*#__PURE__*/_interopDefaultLegacy(dayjs);
7
+
8
+ const blendColor = (colorOne, colorTwo, ratio) => {
9
+ ratio = Math.max(Math.min(Number(ratio), 1), 0);
10
+ const r1 = parseInt(colorOne.slice(1, 3), 16);
11
+ const g1 = parseInt(colorOne.slice(3, 5), 16);
12
+ const b1 = parseInt(colorOne.slice(5, 7), 16);
13
+ const r2 = parseInt(colorTwo.slice(1, 3), 16);
14
+ const g2 = parseInt(colorTwo.slice(3, 5), 16);
15
+ const b2 = parseInt(colorTwo.slice(5, 7), 16);
16
+ let r = Math.round(r1 * (1 - ratio) + r2 * ratio);
17
+ let g = Math.round(g1 * (1 - ratio) + g2 * ratio);
18
+ let b = Math.round(b1 * (1 - ratio) + b2 * ratio);
19
+ r = ("0" + (r || 0).toString(16)).slice(-2);
20
+ g = ("0" + (g || 0).toString(16)).slice(-2);
21
+ b = ("0" + (b || 0).toString(16)).slice(-2);
22
+ return "#" + r + g + b;
23
+ };
24
+ const hexToRgba = (hex, opacity) => {
25
+ const RGBA = "rgba(" + parseInt("0x" + hex.slice(1, 3)) + "," + parseInt("0x" + hex.slice(3, 5)) + "," + parseInt("0x" + hex.slice(5, 7)) + "," + opacity + ")";
26
+ return {
27
+ red: parseInt("0x" + hex.slice(1, 3)),
28
+ green: parseInt("0x" + hex.slice(3, 5)),
29
+ blue: parseInt("0x" + hex.slice(5, 7)),
30
+ rgba: RGBA
31
+ };
32
+ };
33
+ const fuseThemeColor = (color) => ({
34
+ "primaryColorLight-2": blendColor("#ffffff", color, 0.8),
35
+ "primaryColorLight-4": blendColor("#ffffff", color, 0.6),
36
+ "primaryColorLight-6": blendColor("#ffffff", color, 0.4),
37
+ "primaryColorLight-8": blendColor("#ffffff", color, 0.2),
38
+ "primaryColorDark-2": blendColor("#000000", color, 0.8),
39
+ "primaryColorDark-4": blendColor("#000000", color, 0.6),
40
+ "primaryColorDark-6": blendColor("#000000", color, 0.4),
41
+ "primaryColorDark-8": blendColor("#000000", color, 0.2),
42
+ "primaryColorOpacity-2": hexToRgba(color, 0.8).rgba,
43
+ "primaryColorOpacity-4": hexToRgba(color, 0.6).rgba,
44
+ "primaryColorOpacity-6": hexToRgba(color, 0.4).rgba,
45
+ "primaryColorOpacity-8": hexToRgba(color, 0.2).rgba
46
+ });
47
+
48
+ const formatClearHtml = (string_) => string_.replace(/<[!/]*[^<>]*>/gi, "");
49
+ const formatPrice = (value) => {
50
+ return value.replace(/^[^\d+]/, "").replace(/[^\d,.{|}]/g, "").replace(".", "$#$").replace(/\./g, "").replace("$#$", ".").replace(/\.{2,}/g, ".").replace(/^(-)*(\d+)\.(\d\d).*$/, "$1$2.$3");
51
+ };
52
+ const formatInteger = (value) => {
53
+ return value.replace(/^(0+)|\D+/g, "");
54
+ };
55
+ const formatThousandBitSeparator = (target, unit = ",") => {
56
+ if (target === "")
57
+ return "";
58
+ const part = String(target).split(".");
59
+ for (let index = 0; index < part.length; index++) {
60
+ part[index] = part[index].replace(new RegExp("(\\d)(?=(\\d{3})+$)", "ig"), `$1${unit || ""}`);
61
+ }
62
+ return part.join(".");
63
+ };
64
+ const formatUnix = (timestamp, format = "YYYY-MM-DD HH:mm:ss") => {
65
+ return dayjs__default["default"].unix(timestamp).format(format);
66
+ };
67
+ const formatCoverPhone = (phone) => {
68
+ return phone.replace(/^(\d{3})\d{4}(\d{4})$/, "$1****$2");
69
+ };
70
+ const prefixZero = (number_, lh = 2) => {
71
+ return (new Array(lh).join("0") + number_).slice(-lh);
72
+ };
73
+ const capitalizeCamelCase = (string_) => {
74
+ let result = lodash.camelCase(string_);
75
+ result = result.slice(0, 1).toLocaleUpperCase() + result.slice(1);
76
+ return result;
77
+ };
78
+
79
+ const isBrowser = typeof window !== "undefined";
80
+ const isWeex = typeof WXEnvironment !== "undefined" && !!WXEnvironment.platform;
81
+ const weexPlatform = isWeex && WXEnvironment.platform.toLowerCase();
82
+ const UA = isBrowser && window.navigator.userAgent.toLowerCase();
83
+ const isIE = UA && /msie|trident/.test(UA);
84
+ const isIE9 = UA && UA.indexOf("msie 9.0") > 0;
85
+ const isIE11 = navigator.userAgent.includes("Trident") && navigator.userAgent.includes("rv:11.0");
86
+ const isEdge = UA && UA.indexOf("edge/") > 0;
87
+ const isAndroid = UA && UA.indexOf("android") > 0 || weexPlatform === "android";
88
+ const isIOS = UA && /iphone|ipad|ipod|ios/.test(UA) || weexPlatform === "ios";
89
+ const isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
90
+ const isPhantomJS = UA && /phantomjs/.test(UA);
91
+ const isFF = typeof UA == "string" && UA.match(/firefox\/(\d+)/);
92
+ const isMobile = navigator.userAgent.toLowerCase().includes("mobile");
93
+
94
+ const analyUnit = (size, unit = "px") => {
95
+ return lodash.isString(size) && /\D/g.test(size) ? size : size + unit;
96
+ };
97
+ const analySize = (size, unit) => {
98
+ if (typeof size === "string" || typeof size === "number") {
99
+ return { width: analyUnit(size, unit), height: analyUnit(size, unit) };
100
+ }
101
+ if (Array.isArray(size)) {
102
+ return { width: analyUnit(size[0], unit), height: analyUnit(size[1], unit) };
103
+ }
104
+ if (typeof size === "object") {
105
+ return { width: analyUnit(size.width, unit), height: analyUnit(size.height, unit) };
106
+ }
107
+ return { width: "", height: "" };
108
+ };
109
+
110
+ const checkedTypeof = (target) => {
111
+ return Object.prototype.toString.call(target).slice(8, -1);
112
+ };
113
+ const assert = (condition, ...infos) => {
114
+ if (!condition)
115
+ console.warn(...infos);
116
+ return condition;
117
+ };
118
+ const isClient = typeof window !== "undefined";
119
+ const isFormData = (value) => lodash.isObject(value) && value instanceof FormData;
120
+ const isWindow = (value) => typeof window !== "undefined" && toString.call(value) === "[object Window]";
121
+
122
+ const urlParamsAnaly = (url, params) => {
123
+ const queryString = Object.keys(params).map((key) => `${key}=${params[key]}`);
124
+ if (queryString.length > 0)
125
+ url += "?" + queryString.join("&");
126
+ return url;
127
+ };
128
+ const awaitPromise = (code = 1e3) => {
129
+ return new Promise((resolve) => setTimeout(resolve, code));
130
+ };
131
+ const generateArray = (start, end) => {
132
+ start = Number(start);
133
+ end = Number(end);
134
+ end = end > start ? end : start;
135
+ return [...new Array(end + 1).keys()].slice(start);
136
+ };
137
+ const pickByParams = (params, filters, deep = false) => {
138
+ deep && lodash.forIn(params, (value, key) => {
139
+ if (lodash.isObject(value))
140
+ params[key] = pickByParams(params[key], filters, deep);
141
+ });
142
+ const pickValue = lodash.pickBy(params, (value) => !filters.includes(value));
143
+ if (Array.isArray(params)) {
144
+ return Object.values(pickValue);
145
+ }
146
+ return pickValue;
147
+ };
148
+ const formDataToObject = (formData) => {
149
+ return Object.fromEntries(formData.entries());
150
+ };
151
+ const objectToFormData = (object) => {
152
+ const formData = new FormData();
153
+ for (const [key, value] of Object.entries(object)) {
154
+ formData.append(key, value);
155
+ }
156
+ return formData;
157
+ };
158
+ const objectFlat = (object, deep = 1) => {
159
+ const flatDeep = (object2, deep2 = 1) => {
160
+ let _object = {};
161
+ for (const [key, value] of Object.entries(object2)) {
162
+ if (lodash.isPlainObject(value)) {
163
+ _object = { ..._object, ...deep2 > 0 ? flatDeep(value, deep2 - 1) : value };
164
+ continue;
165
+ }
166
+ _object[key] = value;
167
+ }
168
+ return _object;
169
+ };
170
+ return flatDeep(object, deep);
171
+ };
172
+ const noop = () => {
173
+ };
174
+
175
+ exports.UA = UA;
176
+ exports.analySize = analySize;
177
+ exports.analyUnit = analyUnit;
178
+ exports.assert = assert;
179
+ exports.awaitPromise = awaitPromise;
180
+ exports.blendColor = blendColor;
181
+ exports.capitalizeCamelCase = capitalizeCamelCase;
182
+ exports.checkedTypeof = checkedTypeof;
183
+ exports.formDataToObject = formDataToObject;
184
+ exports.formatClearHtml = formatClearHtml;
185
+ exports.formatCoverPhone = formatCoverPhone;
186
+ exports.formatInteger = formatInteger;
187
+ exports.formatPrice = formatPrice;
188
+ exports.formatThousandBitSeparator = formatThousandBitSeparator;
189
+ exports.formatUnix = formatUnix;
190
+ exports.fuseThemeColor = fuseThemeColor;
191
+ exports.generateArray = generateArray;
192
+ exports.hexToRgba = hexToRgba;
193
+ exports.isAndroid = isAndroid;
194
+ exports.isBrowser = isBrowser;
195
+ exports.isChrome = isChrome;
196
+ exports.isClient = isClient;
197
+ exports.isEdge = isEdge;
198
+ exports.isFF = isFF;
199
+ exports.isFormData = isFormData;
200
+ exports.isIE = isIE;
201
+ exports.isIE11 = isIE11;
202
+ exports.isIE9 = isIE9;
203
+ exports.isIOS = isIOS;
204
+ exports.isMobile = isMobile;
205
+ exports.isPhantomJS = isPhantomJS;
206
+ exports.isWeex = isWeex;
207
+ exports.isWindow = isWindow;
208
+ exports.noop = noop;
209
+ exports.objectFlat = objectFlat;
210
+ exports.objectToFormData = objectToFormData;
211
+ exports.pickByParams = pickByParams;
212
+ exports.prefixZero = prefixZero;
213
+ exports.urlParamsAnaly = urlParamsAnaly;
214
+ exports.weexPlatform = weexPlatform;
215
+
216
+ Object.defineProperty(exports, '__esModule', { value: true });
217
+
218
+ })(this.hairyUtils = this.hairyUtils || {}, dayjs, _);
@@ -0,0 +1 @@
1
+ !function(e,r,t){"use strict";function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=i(r);const a=(e,r,t)=>{t=Math.max(Math.min(Number(t),1),0);const i=parseInt(e.slice(1,3),16),o=parseInt(e.slice(3,5),16),a=parseInt(e.slice(5,7),16),n=parseInt(r.slice(1,3),16),s=parseInt(r.slice(3,5),16),l=parseInt(r.slice(5,7),16);let c=Math.round(i*(1-t)+n*t),p=Math.round(o*(1-t)+s*t),f=Math.round(a*(1-t)+l*t);return c=("0"+(c||0).toString(16)).slice(-2),p=("0"+(p||0).toString(16)).slice(-2),f=("0"+(f||0).toString(16)).slice(-2),"#"+c+p+f},n=(e,r)=>{const t="rgba("+parseInt("0x"+e.slice(1,3))+","+parseInt("0x"+e.slice(3,5))+","+parseInt("0x"+e.slice(5,7))+","+r+")";return{red:parseInt("0x"+e.slice(1,3)),green:parseInt("0x"+e.slice(3,5)),blue:parseInt("0x"+e.slice(5,7)),rgba:t}},s="undefined"!=typeof window,l="undefined"!=typeof WXEnvironment&&!!WXEnvironment.platform,c=l&&WXEnvironment.platform.toLowerCase(),p=s&&window.navigator.userAgent.toLowerCase(),f=p&&/msie|trident/.test(p),d=p&&p.indexOf("msie 9.0")>0,m=navigator.userAgent.includes("Trident")&&navigator.userAgent.includes("rv:11.0"),g=p&&p.indexOf("edge/")>0,u=p&&p.indexOf("android")>0||"android"===c,y=p&&/iphone|ipad|ipod|ios/.test(p)||"ios"===c,h=p&&/chrome\/\d+/.test(p)&&!g,b=p&&/phantomjs/.test(p),w="string"==typeof p&&p.match(/firefox\/(\d+)/),C=navigator.userAgent.toLowerCase().includes("mobile"),j=(e,r="px")=>t.isString(e)&&/\D/g.test(e)?e:e+r,x="undefined"!=typeof window,O=(e,r,i=!1)=>{i&&t.forIn(e,((o,a)=>{t.isObject(o)&&(e[a]=O(e[a],r,i))}));const o=t.pickBy(e,(e=>!r.includes(e)));return Array.isArray(e)?Object.values(o):o};e.UA=p,e.analySize=(e,r)=>"string"==typeof e||"number"==typeof e?{width:j(e,r),height:j(e,r)}:Array.isArray(e)?{width:j(e[0],r),height:j(e[1],r)}:"object"==typeof e?{width:j(e.width,r),height:j(e.height,r)}:{width:"",height:""},e.analyUnit=j,e.assert=(e,...r)=>(e||console.warn(...r),e),e.awaitPromise=(e=1e3)=>new Promise((r=>setTimeout(r,e))),e.blendColor=a,e.capitalizeCamelCase=e=>{let r=t.camelCase(e);return r=r.slice(0,1).toLocaleUpperCase()+r.slice(1),r},e.checkedTypeof=e=>Object.prototype.toString.call(e).slice(8,-1),e.formDataToObject=e=>Object.fromEntries(e.entries()),e.formatClearHtml=e=>e.replace(/<[!/]*[^<>]*>/gi,""),e.formatCoverPhone=e=>e.replace(/^(\d{3})\d{4}(\d{4})$/,"$1****$2"),e.formatInteger=e=>e.replace(/^(0+)|\D+/g,""),e.formatPrice=e=>e.replace(/^[^\d+]/,"").replace(/[^\d,.{|}]/g,"").replace(".","$#$").replace(/\./g,"").replace("$#$",".").replace(/\.{2,}/g,".").replace(/^(-)*(\d+)\.(\d\d).*$/,"$1$2.$3"),e.formatThousandBitSeparator=(e,r=",")=>{if(""===e)return"";const t=String(e).split(".");for(let e=0;e<t.length;e++)t[e]=t[e].replace(new RegExp("(\\d)(?=(\\d{3})+$)","ig"),`$1${r||""}`);return t.join(".")},e.formatUnix=(e,r="YYYY-MM-DD HH:mm:ss")=>o.default.unix(e).format(r),e.fuseThemeColor=e=>({"primaryColorLight-2":a("#ffffff",e,.8),"primaryColorLight-4":a("#ffffff",e,.6),"primaryColorLight-6":a("#ffffff",e,.4),"primaryColorLight-8":a("#ffffff",e,.2),"primaryColorDark-2":a("#000000",e,.8),"primaryColorDark-4":a("#000000",e,.6),"primaryColorDark-6":a("#000000",e,.4),"primaryColorDark-8":a("#000000",e,.2),"primaryColorOpacity-2":n(e,.8).rgba,"primaryColorOpacity-4":n(e,.6).rgba,"primaryColorOpacity-6":n(e,.4).rgba,"primaryColorOpacity-8":n(e,.2).rgba}),e.generateArray=(e,r)=>(e=Number(e),r=(r=Number(r))>e?r:e,[...new Array(r+1).keys()].slice(e)),e.hexToRgba=n,e.isAndroid=u,e.isBrowser=s,e.isChrome=h,e.isClient=x,e.isEdge=g,e.isFF=w,e.isFormData=e=>t.isObject(e)&&e instanceof FormData,e.isIE=f,e.isIE11=m,e.isIE9=d,e.isIOS=y,e.isMobile=C,e.isPhantomJS=b,e.isWeex=l,e.isWindow=e=>"undefined"!=typeof window&&"[object Window]"===toString.call(e),e.noop=()=>{},e.objectFlat=(e,r=1)=>{const i=(e,r=1)=>{let o={};for(const[a,n]of Object.entries(e))t.isPlainObject(n)?o={...o,...r>0?i(n,r-1):n}:o[a]=n;return o};return i(e,r)},e.objectToFormData=e=>{const r=new FormData;for(const[t,i]of Object.entries(e))r.append(t,i);return r},e.pickByParams=O,e.prefixZero=(e,r=2)=>(new Array(r).join("0")+e).slice(-r),e.urlParamsAnaly=(e,r)=>{const t=Object.keys(r).map((e=>`${e}=${r[e]}`));return t.length>0&&(e+="?"+t.join("&")),e},e.weexPlatform=c,Object.defineProperty(e,"__esModule",{value:!0})}(this.hairyUtils=this.hairyUtils||{},dayjs,_);
package/package.json ADDED
@@ -0,0 +1,38 @@
1
+ {
2
+ "name": "@hairy/utils",
3
+ "version": "1.0.14",
4
+ "license": "MIT",
5
+ "dependencies": {
6
+ "dayjs": "^1.10.6",
7
+ "lodash": "^4.17.21"
8
+ },
9
+ "devDependencies": {
10
+ "@types/lodash": "^4.14.171"
11
+ },
12
+ "main": "./index.cjs.js",
13
+ "types": "./index.d.ts",
14
+ "module": "./index.esm.js",
15
+ "unpkg": "./index.iife.min.js",
16
+ "jsdelivr": "./index.iife.min.js",
17
+ "author": "Anthony Fu<https://github.com/TuiMao233>",
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "git+https://github.com/TuiMao233/hairylib.git"
21
+ },
22
+ "bugs": {
23
+ "url": "https://github.com/TuiMao233/hairylib/issues"
24
+ },
25
+ "homepage": "https://github.com/TuiMao233/hairylib#readme",
26
+ "description": "Utilities core for Mr.Mao",
27
+ "exports": {
28
+ ".": {
29
+ "import": "./index.esm.js",
30
+ "require": "./index.cjs.js"
31
+ },
32
+ "./*": "./*"
33
+ },
34
+ "gitHead": "8fbecb4d66553d61eed585bcbf63ffb1d14ce900",
35
+ "publishConfig": {
36
+ "access": "public"
37
+ }
38
+ }