Prefer template strings
This commit is contained in:
parent
ebde1f2756
commit
e918dbccb0
@ -91,14 +91,14 @@ export default class uAjax {
|
||||
} else {
|
||||
for (const key in data) {
|
||||
if (data.hasOwnProperty(key)) {
|
||||
params.push(key + '=' + encodeURIComponent(data[key]));
|
||||
params.push(`${key}=${encodeURIComponent(data[key])}`);
|
||||
}
|
||||
}
|
||||
body = params.join('&');
|
||||
body = body.replace(/%20/g, '+');
|
||||
}
|
||||
if (method === 'GET' && body.length) {
|
||||
url += '?' + body;
|
||||
url += `?${body}`;
|
||||
body = null;
|
||||
}
|
||||
xhr.open(method, url, true);
|
||||
|
@ -135,10 +135,10 @@ export default class uUtils {
|
||||
* @returns {string}
|
||||
*/
|
||||
static hexToRGBA(hex, opacity) {
|
||||
return 'rgba(' + (hex = hex.replace('#', ''))
|
||||
.match(new RegExp('(.{' + hex.length / 3 + '})', 'g'))
|
||||
return `rgba(${(hex = hex.replace('#', ''))
|
||||
.match(new RegExp(`(.{${hex.length / 3}})`, 'g'))
|
||||
.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