Prefer template strings
This commit is contained in:
parent
ebde1f2756
commit
e918dbccb0
@ -91,14 +91,14 @@ export default class uAjax {
|
|||||||
} else {
|
} else {
|
||||||
for (const key in data) {
|
for (const key in data) {
|
||||||
if (data.hasOwnProperty(key)) {
|
if (data.hasOwnProperty(key)) {
|
||||||
params.push(key + '=' + encodeURIComponent(data[key]));
|
params.push(`${key}=${encodeURIComponent(data[key])}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
body = params.join('&');
|
body = params.join('&');
|
||||||
body = body.replace(/%20/g, '+');
|
body = body.replace(/%20/g, '+');
|
||||||
}
|
}
|
||||||
if (method === 'GET' && body.length) {
|
if (method === 'GET' && body.length) {
|
||||||
url += '?' + body;
|
url += `?${body}`;
|
||||||
body = null;
|
body = null;
|
||||||
}
|
}
|
||||||
xhr.open(method, url, true);
|
xhr.open(method, url, true);
|
||||||
|
@ -135,10 +135,10 @@ export default class uUtils {
|
|||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
static hexToRGBA(hex, opacity) {
|
static hexToRGBA(hex, opacity) {
|
||||||
return 'rgba(' + (hex = hex.replace('#', ''))
|
return `rgba(${(hex = hex.replace('#', ''))
|
||||||
.match(new RegExp('(.{' + hex.length / 3 + '})', 'g'))
|
.match(new RegExp(`(.{${hex.length / 3}})`, 'g'))
|
||||||
.map((l) => parseInt(hex.length % 2 ? l + l : l, 16))
|
.map((l) => parseInt(hex.length % 2 ? l + l : l, 16))
|
||||||
.concat(opacity || 1).join(',') + ')';
|
.concat(opacity || 1).join(',')})`;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user