1 | /**
|
2 | * remove ^\/+
|
3 | * @param name
|
4 | */
|
5 | export function objectName(name: string) {
|
6 | return name.replace(/^\/+/, '');
|
7 | }
|
8 |
|
9 | export function escapeName(name: string) {
|
10 | return encodeURIComponent(name).replace(/%2F/g, '/');
|
11 | }
|
12 |
|
13 | export function isHttpsProtocol() {
|
14 | return location && location.protocol === 'https:';
|
15 | }
|
16 |
|
17 | /*
|
18 | export function setRegion(region: string, secure: boolean, internal?: boolean) {
|
19 | // const protocol = secure ? 'https//' : 'http://';
|
20 | return `http${secure?'s':''}://${region}.aliyuncs.com`;
|
21 | // const suffix = internal ? '-internal.aliyuncs.com' : '.aliyuncs.com';
|
22 | // return protocol + region + suffix;
|
23 | }
|
24 | */
|
25 |
|
26 | export function typeOf(object: any) {
|
27 | return Object.prototype.toString.call(object).slice(8, -1).toLocaleLowerCase();
|
28 | }
|