@10yun/cv-mobile-ui 0.5.37 → 0.5.39

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 (36) hide show
  1. package/README.md +1 -1
  2. package/libs/amap-wx.130.js +485 -0
  3. package/libs/amap-wx.js +517 -0
  4. package/libs/highlight/github-dark.min.css +10 -0
  5. package/libs/highlight/highlight-uni.min.js +5256 -0
  6. package/libs/html-parser.js +352 -0
  7. package/libs/jweixin-module.js +1 -0
  8. package/libs/markdown-it.min.js +2 -0
  9. package/libs/md5.js +774 -0
  10. package/libs/permission.js +244 -0
  11. package/libs/qqmap-wx-jssdk.js +1178 -0
  12. package/package.json +2 -2
  13. package/plugins/luch-request/utils/clone.js +28 -32
  14. package/plugins/{map/uniMap.js → uniMap.js} +0 -20
  15. package/ui-cv/components/cv-code-sms/cv-code-sms.vue +9 -0
  16. package/uview-plus/libs/ctocode/index.js +1 -10
  17. package/uview-plus/libs/luch-request/adapters/index.js +113 -79
  18. package/uview-plus/libs/luch-request/core/InterceptorManager.js +19 -19
  19. package/uview-plus/libs/luch-request/core/Request.js +146 -146
  20. package/uview-plus/libs/luch-request/core/buildFullPath.js +7 -7
  21. package/uview-plus/libs/luch-request/core/defaults.js +27 -24
  22. package/uview-plus/libs/luch-request/core/dispatchRequest.js +4 -2
  23. package/uview-plus/libs/luch-request/core/mergeConfig.js +106 -84
  24. package/uview-plus/libs/luch-request/core/settle.js +7 -7
  25. package/uview-plus/libs/luch-request/helpers/buildURL.js +50 -48
  26. package/uview-plus/libs/luch-request/helpers/combineURLs.js +2 -4
  27. package/uview-plus/libs/luch-request/helpers/isAbsoluteURL.js +5 -5
  28. package/uview-plus/libs/luch-request/index.d.ts +184 -103
  29. package/uview-plus/libs/luch-request/index.js +2 -3
  30. package/uview-plus/libs/luch-request/readme.md +3 -0
  31. package/uview-plus/libs/luch-request/utils/clone.js +28 -32
  32. package/uview-plus/libs/luch-request/utils.js +41 -41
  33. package/plugins/map/lib/amap-wx.js +0 -1
  34. package/plugins/request.js +0 -571
  35. /package/{plugins/map → libs}/amqp-wx.js +0 -0
  36. /package/{plugins/map → libs}/qqmap.js +0 -0
@@ -1,16 +1,16 @@
1
- 'use strict'
1
+ 'use strict';
2
2
 
3
- import * as utils from '../utils'
3
+ import * as utils from './../utils';
4
4
 
5
5
  function encode(val) {
6
- return encodeURIComponent(val)
7
- .replace(/%40/gi, '@')
8
- .replace(/%3A/gi, ':')
9
- .replace(/%24/g, '$')
10
- .replace(/%2C/gi, ',')
11
- .replace(/%20/g, '+')
12
- .replace(/%5B/gi, '[')
13
- .replace(/%5D/gi, ']')
6
+ return encodeURIComponent(val)
7
+ .replace(/%40/gi, '@')
8
+ .replace(/%3A/gi, ':')
9
+ .replace(/%24/g, '$')
10
+ .replace(/%2C/gi, ',')
11
+ .replace(/%20/g, '+')
12
+ .replace(/%5B/gi, '[')
13
+ .replace(/%5D/gi, ']');
14
14
  }
15
15
 
16
16
  /**
@@ -20,50 +20,52 @@ function encode(val) {
20
20
  * @param {object} [params] The params to be appended
21
21
  * @returns {string} The formatted url
22
22
  */
23
- export default function buildURL(url, params) {
24
- /* eslint no-param-reassign:0 */
25
- if (!params) {
26
- return url
27
- }
28
-
29
- let serializedParams
30
- if (utils.isURLSearchParams(params)) {
31
- serializedParams = params.toString()
32
- } else {
33
- const parts = []
34
-
35
- utils.forEach(params, (val, key) => {
36
- if (val === null || typeof val === 'undefined') {
37
- return
38
- }
23
+ export default function buildURL(url, params, paramsSerializer) {
24
+ /*eslint no-param-reassign:0*/
25
+ if (!params) {
26
+ return url;
27
+ }
39
28
 
40
- if (utils.isArray(val)) {
41
- key = `${key}[]`
42
- } else {
43
- val = [val]
44
- }
29
+ var serializedParams;
30
+ if (paramsSerializer) {
31
+ serializedParams = paramsSerializer(params);
32
+ } else if (utils.isURLSearchParams(params)) {
33
+ serializedParams = params.toString();
34
+ } else {
35
+ var parts = [];
45
36
 
46
- utils.forEach(val, (v) => {
47
- if (utils.isDate(v)) {
48
- v = v.toISOString()
49
- } else if (utils.isObject(v)) {
50
- v = JSON.stringify(v)
51
- }
52
- parts.push(`${encode(key)}=${encode(v)}`)
53
- })
54
- })
37
+ utils.forEach(params, function serialize(val, key) {
38
+ if (val === null || typeof val === 'undefined') {
39
+ return;
40
+ }
55
41
 
56
- serializedParams = parts.join('&')
57
- }
42
+ if (utils.isArray(val)) {
43
+ key = key + '[]';
44
+ } else {
45
+ val = [val];
46
+ }
58
47
 
59
- if (serializedParams) {
60
- const hashmarkIndex = url.indexOf('#')
61
- if (hashmarkIndex !== -1) {
62
- url = url.slice(0, hashmarkIndex)
48
+ utils.forEach(val, function parseValue(v) {
49
+ if (utils.isDate(v)) {
50
+ v = v.toISOString();
51
+ } else if (utils.isObject(v)) {
52
+ v = JSON.stringify(v);
63
53
  }
54
+ parts.push(encode(key) + '=' + encode(v));
55
+ });
56
+ });
57
+
58
+ serializedParams = parts.join('&');
59
+ }
64
60
 
65
- url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams
61
+ if (serializedParams) {
62
+ var hashmarkIndex = url.indexOf('#');
63
+ if (hashmarkIndex !== -1) {
64
+ url = url.slice(0, hashmarkIndex);
66
65
  }
67
66
 
68
- return url
67
+ url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
68
+ }
69
+
70
+ return url;
69
71
  }
@@ -1,4 +1,4 @@
1
- 'use strict'
1
+ 'use strict';
2
2
 
3
3
  /**
4
4
  * Creates a new URL by combining the specified URLs
@@ -8,7 +8,5 @@
8
8
  * @returns {string} The combined URL
9
9
  */
10
10
  export default function combineURLs(baseURL, relativeURL) {
11
- return relativeURL
12
- ? `${baseURL.replace(/\/+$/, '')}/${relativeURL.replace(/^\/+/, '')}`
13
- : baseURL
11
+ return relativeURL ? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '') : baseURL;
14
12
  }
@@ -1,4 +1,4 @@
1
- 'use strict'
1
+ 'use strict';
2
2
 
3
3
  /**
4
4
  * Determines whether the specified URL is absolute
@@ -7,8 +7,8 @@
7
7
  * @returns {boolean} True if the specified URL is absolute, otherwise false
8
8
  */
9
9
  export default function isAbsoluteURL(url) {
10
- // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
11
- // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
12
- // by any combination of letters, digits, plus, period, or hyphen.
13
- return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url)
10
+ // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
11
+ // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
12
+ // by any combination of letters, digits, plus, period, or hyphen.
13
+ return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
14
14
  }
@@ -1,116 +1,197 @@
1
- type AnyObject = Record<string | number | symbol, any>
2
- type HttpPromise<T> = Promise<HttpResponse<T>>;
3
- type Tasks = UniApp.RequestTask | UniApp.UploadTask | UniApp.DownloadTask
4
- export interface RequestTask {
5
- abort: () => void;
6
- offHeadersReceived: () => void;
7
- onHeadersReceived: () => void;
8
- }
9
- export interface HttpRequestConfig<T = Tasks> {
10
- /** 请求基地址 */
11
- baseURL?: string;
12
- /** 请求服务器接口地址 */
13
- url?: string;
14
-
15
- /** 请求查询参数,自动拼接为查询字符串 */
16
- params?: AnyObject;
17
- /** 请求体参数 */
18
- data?: AnyObject;
19
-
20
- /** 文件对应的 key */
21
- name?: string;
22
- /** HTTP 请求中其他额外的 form data */
23
- formData?: AnyObject;
24
- /** 要上传文件资源的路径。 */
25
- filePath?: string;
26
- /** 需要上传的文件列表。使用 files 时,filePath 和 name 不生效,App、H5( 2.6.15+) */
27
- files?: Array<{
28
- name?: string;
1
+ export type HttpTask = UniApp.RequestTask | UniApp.UploadTask | UniApp.DownloadTask;
2
+
3
+ export type HttpRequestTask = UniApp.RequestTask;
4
+
5
+ export type HttpUploadTask = UniApp.UploadTask;
6
+
7
+ export type HttpDownloadTask = UniApp.DownloadTask;
8
+
9
+ export type HttpMethod =
10
+ "GET"
11
+ | "POST"
12
+ | "PUT"
13
+ | "DELETE"
14
+ | "CONNECT"
15
+ | "HEAD"
16
+ | "OPTIONS"
17
+ | "TRACE"
18
+ | "UPLOAD"
19
+ | "DOWNLOAD";
20
+
21
+ export type HttpRequestHeader = Record<string, string>;
22
+
23
+ export type HttpParams = Record<string, any>;
24
+
25
+ export type HttpData = Record<string, any>;
26
+
27
+ export type HttpResponseType = 'arraybuffer' | 'text';
28
+
29
+ export type HttpCustom = Record<string, any>;
30
+
31
+ export type HttpFileType = 'image' | 'video' | 'audio';
32
+
33
+ export type HttpFormData = Record<string, any>;
34
+
35
+ export type HttpResponseHeader = Record<string, string> & {
36
+ "set-cookie"?: string[]
37
+ };
38
+
39
+ export interface HttpRequestConfig<T = HttpTask> {
40
+ /** @desc 请求服务器接口地址 */
41
+ url?: string;
42
+ /** @desc 请求方式,默认为 GET */
43
+ method?: HttpMethod;
44
+ /** @desc 请求基地址 */
45
+ baseURL?: string;
46
+ /** @desc 请求头信息,不能设置 Referer,App、H5 端会自动带上 cookie,且 H5 端不可手动修改 */
47
+ header?: HttpRequestHeader;
48
+ /** @desc 请求查询参数,自动拼接为查询字符串 */
49
+ params?: HttpParams;
50
+ /** @desc 请求体参数 */
51
+ data?: HttpData;
52
+ /** @desc 超时时间,单位 ms,默认为 60000,仅 H5 (HBuilderX 2.9.9+)、APP (HBuilderX 2.9.9+)、微信小程序 (2.10.0)、支付宝小程序支持 */
53
+ timeout?: number;
54
+ /** @desc 跨域请求时是否携带凭证 (cookies),默认为 false,仅 H5 (HBuilderX 2.6.15+) 支持 */
55
+ withCredentials?: boolean;
56
+ /** @desc 设置响应的数据类型,支付宝小程序不支持 */
57
+ responseType?: HttpResponseType;
58
+ /** @desc 全局自定义验证器 */
59
+ validateStatus?: ((statusCode: number) => boolean) | null;
60
+
61
+
62
+ /** params 参数自定义处理 */
63
+ paramsSerializer?: (params: AnyObject) => string | void;
64
+
65
+ /** @desc 默认为 json,如果设为 json,会尝试对返回的数据做一次 JSON.parse */
66
+ dataType?: string;
67
+ /** @desc DNS 解析时是否优先使用 ipv4,默认为 false,仅 App-Android (HBuilderX 2.8.0+) 支持 */
68
+ firstIpv4?: boolean;
69
+ /** @desc 是否验证 SSL 证书,默认为 true,仅 App-Android (HBuilderX 2.3.3+) 支持 */
70
+ sslVerify?: boolean;
71
+
72
+ /** @desc 开启 http2;微信小程序 */
73
+ enableHttp2?: boolean;
74
+
75
+ /** @desc 开启 quic;微信小程序 */
76
+ enableQuic?: boolean;
77
+ /** @desc 开启 cache;微信小程序、字节跳动小程序 2.31.0+ */
78
+ enableCache?: boolean;
79
+ /** @desc 开启 httpDNS;微信小程序 */
80
+ enableHttpDNS?: boolean;
81
+ /** @desc httpDNS 服务商;微信小程序 */
82
+ httpDNSServiceId?: string;
83
+ /** @desc 开启 transfer-encoding chunked;微信小程序 */
84
+ enableChunked?: boolean;
85
+ /** @desc wifi下使用移动网络发送请求;微信小程序 */
86
+ forceCellularNetwork?: boolean;
87
+ /** @desc 开启后可在headers中编辑cookie;支付宝小程序 10.2.33+ */
88
+ enableCookie?: boolean;
89
+ /** @desc 是否开启云加速;百度小程序 3.310.11+ */
90
+ cloudCache?: boolean | object;
91
+ /** @desc 控制当前请求是否延时至首屏内容渲染后发送;百度小程序 3.310.11+ */
92
+ defer?: boolean;
93
+
94
+ /** @desc 自定义参数 */
95
+ custom?: HttpCustom;
96
+
97
+ /** @desc 返回当前请求的 task 和 options,不要在这里修改 options */
98
+ getTask?: (task: T, options: HttpRequestConfig<T>) => void;
99
+
100
+ /** @desc 需要上传的文件列表,使用 files 时,filePath 和 name 不生效,仅支持 App、H5 (2.6.15+) */
101
+ files?: { name?: string; file?: File; uri: string; }[];
102
+ /** @desc 文件类型,仅支付宝小程序支持且为必填项 */
103
+ fileType?: HttpFileType;
104
+ /** @desc 要上传的文件对象,仅 H5 (2.6.15+) 支持 */
29
105
  file?: File;
30
- uri: string;
31
- }>;
32
- /** 要上传的文件对象,仅H5(2.6.15+)支持 */
33
- file?: File;
34
-
35
- /** 请求头信息 */
36
- header?: AnyObject;
37
- /** 请求方式 */
38
- method?: "GET" | "POST" | "PUT" | "DELETE" | "CONNECT" | "HEAD" | "OPTIONS" | "TRACE" | "UPLOAD" | "DOWNLOAD";
39
- /** 如果设为 json,会尝试对返回的数据做一次 JSON.parse */
40
- dataType?: string;
41
- /** 设置响应的数据类型,支付宝小程序不支持 */
42
- responseType?: "text" | "arraybuffer";
43
- /** 自定义参数 */
44
- custom?: AnyObject;
45
- /** 超时时间,仅微信小程序(2.10.0)、支付宝小程序支持 */
46
- timeout?: number;
47
- /** DNS解析时优先使用ipv4,仅 App-Android 支持 (HBuilderX 2.8.0+) */
48
- firstIpv4?: boolean;
49
- /** 验证 ssl 证书 仅5+App安卓端支持(HBuilderX 2.3.3+) */
50
- sslVerify?: boolean;
51
- /** 跨域请求时是否携带凭证(cookies)仅H5支持(HBuilderX 2.6.15+) */
52
- withCredentials?: boolean;
53
-
54
- /** 返回当前请求的task, options。请勿在此处修改options。 */
55
- getTask?: (task: T, options: HttpRequestConfig<T>) => void;
56
- /** 全局自定义验证器 */
57
- validateStatus?: (statusCode: number) => boolean | void;
106
+ /** @desc 要上传文件资源的路径,使用 files 时,filePath 和 name 不生效 */
107
+ filePath?: string;
108
+ /** @desc 文件对应的 key,开发者在服务器端通过这个 key 可以获取到文件二进制内容,使用 files 时,filePath 和 name 不生效 */
109
+ name?: string;
110
+ /** @desc 请求中其他额外的 form data */
111
+ formData?: HttpFormData;
58
112
  }
59
- export interface HttpResponse<T = any> {
60
- config: HttpRequestConfig;
61
- statusCode: number;
62
- cookies: Array<string>;
63
- data: T;
64
- errMsg: string;
65
- header: AnyObject;
113
+
114
+ export interface HttpResponse<T = any, D = HttpTask> {
115
+ data: T;
116
+ statusCode: number;
117
+ header: HttpResponseHeader;
118
+ config: HttpRequestConfig<D>;
119
+ cookies: string[];
120
+ errMsg: string;
121
+ rawData: any;
66
122
  }
67
- export interface HttpUploadResponse<T = any> {
68
- config: HttpRequestConfig;
69
- statusCode: number;
70
- data: T;
71
- errMsg: string;
123
+
124
+ export interface HttpUploadResponse<T = any, D = HttpTask> {
125
+ data: T;
126
+ statusCode: number;
127
+ config: HttpRequestConfig<D>;
128
+ errMsg: string;
129
+ rawData: any;
72
130
  }
131
+
73
132
  export interface HttpDownloadResponse extends HttpResponse {
74
- tempFilePath: string;
133
+ tempFilePath: string;
134
+ apFilePath?: string;
135
+ filePath?: string;
136
+ fileContent?: string;
75
137
  }
76
- export interface HttpError {
77
- config: HttpRequestConfig;
78
- statusCode?: number;
79
- cookies?: Array<string>;
80
- data?: any;
81
- errMsg: string;
82
- header?: AnyObject;
138
+
139
+ export interface HttpError<T = any, D = HttpTask> {
140
+ data?: T;
141
+ statusCode?: number;
142
+ header?: HttpResponseHeader;
143
+ config: HttpRequestConfig<D>;
144
+ cookies?: string[];
145
+ errMsg: string;
83
146
  }
147
+
148
+ export interface HttpPromise<T = any> extends Promise<HttpResponse<T>> {
149
+ }
150
+
84
151
  export interface HttpInterceptorManager<V, E = V> {
85
- use(
86
- onFulfilled?: (config: V) => Promise<V> | V,
87
- onRejected?: (config: E) => Promise<E> | E
88
- ): void;
89
- eject(id: number): void;
152
+ use(onFulfilled?: (value: V) => V | Promise<V>, onRejected?: (error: E) => T | Promise<E>): void;
153
+
154
+ eject(id: number): void;
90
155
  }
156
+
91
157
  export abstract class HttpRequestAbstract {
92
- constructor(config?: HttpRequestConfig);
93
- config: HttpRequestConfig;
94
- interceptors: {
95
- request: HttpInterceptorManager<HttpRequestConfig, HttpRequestConfig>;
96
- response: HttpInterceptorManager<HttpResponse, HttpError>;
97
- }
98
- middleware<T = any>(config: HttpRequestConfig): HttpPromise<T>;
99
- request<T = any>(config: HttpRequestConfig<UniApp.RequestTask>): HttpPromise<T>;
100
- get<T = any>(url: string, config?: HttpRequestConfig<UniApp.RequestTask>): HttpPromise<T>;
101
- upload<T = any>(url: string, config?: HttpRequestConfig<UniApp.UploadTask>): HttpPromise<T>;
102
- delete<T = any>(url: string, data?: AnyObject, config?: HttpRequestConfig<UniApp.RequestTask>): HttpPromise<T>;
103
- head<T = any>(url: string, data?: AnyObject, config?: HttpRequestConfig<UniApp.RequestTask>): HttpPromise<T>;
104
- post<T = any>(url: string, data?: AnyObject, config?: HttpRequestConfig<UniApp.RequestTask>): HttpPromise<T>;
105
- put<T = any>(url: string, data?: AnyObject, config?: HttpRequestConfig<UniApp.RequestTask>): HttpPromise<T>;
106
- connect<T = any>(url: string, data?: AnyObject, config?: HttpRequestConfig<UniApp.RequestTask>): HttpPromise<T>;
107
- options<T = any>(url: string, data?: AnyObject, config?: HttpRequestConfig<UniApp.RequestTask>): HttpPromise<T>;
108
- trace<T = any>(url: string, data?: AnyObject, config?: HttpRequestConfig<UniApp.RequestTask>): HttpPromise<T>;
109
-
110
- download(url: string, config?: HttpRequestConfig<UniApp.DownloadTask>): Promise<HttpDownloadResponse>;
111
-
112
- setConfig(onSend: (config: HttpRequestConfig) => HttpRequestConfig): void;
158
+ constructor(config?: HttpRequestConfig);
159
+
160
+ interceptors: {
161
+ request: HttpInterceptorManager<HttpRequestConfig>;
162
+ response: HttpInterceptorManager<HttpResponse, HttpError>;
163
+ }
164
+
165
+ request<T = any, R = HttpResponse<T>, D = HttpRequestTask>(config: HttpRequestConfig<D>): Promise<R>;
166
+
167
+ get<T = any, R = HttpResponse<T>, D = HttpRequestTask>(url: string, config?: HttpRequestConfig<D>): Promise<R>;
168
+
169
+ delete<T = any, R = HttpResponse<T>, D = HttpRequestTask>(url: string, data?: HttpData, config?: HttpRequestConfig<D>): Promise<R>;
170
+
171
+ head<T = any, R = HttpResponse<T>, D = HttpRequestTask>(url: string, data?: HttpData, config?: HttpRequestConfig<D>): Promise<R>;
172
+
173
+ options<T = any, R = HttpResponse<T>, D = HttpRequestTask>(url: string, data?: HttpData, config?: HttpRequestConfig<D>): Promise<R>;
174
+
175
+ post<T = any, R = HttpResponse<T>, D = HttpRequestTask>(url: string, data?: HttpData, config?: HttpRequestConfig<D>): Promise<R>;
176
+
177
+ put<T = any, R = HttpResponse<T>, D = HttpRequestTask>(url: string, data?: HttpData, config?: HttpRequestConfig<D>): Promise<R>;
178
+
179
+ config: HttpRequestConfig;
180
+
181
+ setConfig<D = HttpTask>(onSend: (config: HttpRequestConfig<D>) => HttpRequestConfig<D>): void;
182
+
183
+ connect<T = any, R = HttpResponse<T>, D = HttpRequestTask>(url: string, data?: HttpData, config?: HttpRequestConfig<D>): Promise<R>;
184
+
185
+ trace<T = any, R = HttpResponse<T>, D = HttpRequestTask>(url: string, data?: HttpData, config?: HttpRequestConfig<D>): Promise<R>;
186
+
187
+ upload<T = any, R = HttpUploadResponse<T>, D = HttpUploadTask>(url: string, config?: HttpRequestConfig<D>): Promise<R>;
188
+
189
+ download<T = any, R = HttpDownloadResponse<T>, D = HttpDownloadTask>(url: string, config?: HttpRequestConfig<D>): Promise<R>;
190
+
191
+ middleware<T = any, R = HttpResponse<T>, D = HttpTask>(config: HttpRequestConfig<D>): Promise<R>;
192
+ }
193
+
194
+ declare class HttpRequest extends HttpRequestAbstract {
113
195
  }
114
196
 
115
- declare class HttpRequest extends HttpRequestAbstract { }
116
197
  export default HttpRequest;
@@ -1,3 +1,2 @@
1
- import Request from './core/Request'
2
-
3
- export default Request
1
+ import Request from './core/Request';
2
+ export default Request;
@@ -0,0 +1,3 @@
1
+ # 版本
2
+
3
+ 3.1.0
@@ -1,5 +1,5 @@
1
1
  /* eslint-disable */
2
- var clone = (function() {
2
+ var clone = (function () {
3
3
  'use strict';
4
4
 
5
5
  function _instanceof(obj, type) {
@@ -9,24 +9,24 @@ var clone = (function() {
9
9
  var nativeMap;
10
10
  try {
11
11
  nativeMap = Map;
12
- } catch(_) {
12
+ } catch (_) {
13
13
  // maybe a reference error because no `Map`. Give it a dummy value that no
14
14
  // value will ever be an instanceof.
15
- nativeMap = function() {};
15
+ nativeMap = function () {};
16
16
  }
17
17
 
18
18
  var nativeSet;
19
19
  try {
20
20
  nativeSet = Set;
21
- } catch(_) {
22
- nativeSet = function() {};
21
+ } catch (_) {
22
+ nativeSet = function () {};
23
23
  }
24
24
 
25
25
  var nativePromise;
26
26
  try {
27
27
  nativePromise = Promise;
28
- } catch(_) {
29
- nativePromise = function() {};
28
+ } catch (_) {
29
+ nativePromise = function () {};
30
30
  }
31
31
 
32
32
  /**
@@ -64,20 +64,16 @@ var clone = (function() {
64
64
 
65
65
  var useBuffer = typeof Buffer != 'undefined';
66
66
 
67
- if (typeof circular == 'undefined')
68
- circular = true;
67
+ if (typeof circular == 'undefined') circular = true;
69
68
 
70
- if (typeof depth == 'undefined')
71
- depth = Infinity;
69
+ if (typeof depth == 'undefined') depth = Infinity;
72
70
 
73
71
  // recurse this function so we don't reset allParents and allChildren
74
72
  function _clone(parent, depth) {
75
73
  // cloning null always returns null
76
- if (parent === null)
77
- return null;
74
+ if (parent === null) return null;
78
75
 
79
- if (depth === 0)
80
- return parent;
76
+ if (depth === 0) return parent;
81
77
 
82
78
  var child;
83
79
  var proto;
@@ -91,11 +87,14 @@ var clone = (function() {
91
87
  child = new nativeSet();
92
88
  } else if (_instanceof(parent, nativePromise)) {
93
89
  child = new nativePromise(function (resolve, reject) {
94
- parent.then(function(value) {
95
- resolve(_clone(value, depth - 1));
96
- }, function(err) {
97
- reject(_clone(err, depth - 1));
98
- });
90
+ parent.then(
91
+ function (value) {
92
+ resolve(_clone(value, depth - 1));
93
+ },
94
+ function (err) {
95
+ reject(_clone(err, depth - 1));
96
+ }
97
+ );
99
98
  });
100
99
  } else if (clone.__isArray(parent)) {
101
100
  child = [];
@@ -120,8 +119,7 @@ var clone = (function() {
120
119
  if (typeof prototype == 'undefined') {
121
120
  proto = Object.getPrototypeOf(parent);
122
121
  child = Object.create(proto);
123
- }
124
- else {
122
+ } else {
125
123
  child = Object.create(prototype);
126
124
  proto = prototype;
127
125
  }
@@ -138,14 +136,14 @@ var clone = (function() {
138
136
  }
139
137
 
140
138
  if (_instanceof(parent, nativeMap)) {
141
- parent.forEach(function(value, key) {
139
+ parent.forEach(function (value, key) {
142
140
  var keyChild = _clone(key, depth - 1);
143
141
  var valueChild = _clone(value, depth - 1);
144
142
  child.set(keyChild, valueChild);
145
143
  });
146
144
  }
147
145
  if (_instanceof(parent, nativeSet)) {
148
- parent.forEach(function(value) {
146
+ parent.forEach(function (value) {
149
147
  var entryChild = _clone(value, depth - 1);
150
148
  child.add(entryChild);
151
149
  });
@@ -164,17 +162,16 @@ var clone = (function() {
164
162
  continue;
165
163
  }
166
164
  child[i] = _clone(parent[i], depth - 1);
167
- } catch(e){
165
+ } catch (e) {
168
166
  if (e instanceof TypeError) {
169
167
  // when in strict mode, TypeError will be thrown if child[i] property only has a getter
170
168
  // we can't do anything about this, other than inform the user that this property cannot be set.
171
- continue
169
+ continue;
172
170
  } else if (e instanceof ReferenceError) {
173
171
  //this may happen in non strict mode
174
- continue
172
+ continue;
175
173
  }
176
174
  }
177
-
178
175
  }
179
176
 
180
177
  if (Object.getOwnPropertySymbols) {
@@ -219,15 +216,14 @@ var clone = (function() {
219
216
  * works.
220
217
  */
221
218
  clone.clonePrototype = function clonePrototype(parent) {
222
- if (parent === null)
223
- return null;
219
+ if (parent === null) return null;
224
220
 
225
221
  var c = function () {};
226
222
  c.prototype = parent;
227
223
  return new c();
228
224
  };
229
225
 
230
- // private utility functions
226
+ // private utility functions
231
227
 
232
228
  function __objToStr(o) {
233
229
  return Object.prototype.toString.call(o);
@@ -261,4 +257,4 @@ var clone = (function() {
261
257
  return clone;
262
258
  })();
263
259
 
264
- export default clone
260
+ export default clone;