Metrics
There are 13 functions in this file.
Function with the largest signature take 1 arguments, while the median is 1.
Largest function has 13 statements in it, while the median is 1.
The most complex function has a cyclomatic complexity value of 3 while the median is 1.
Eight warnings
19 Missing semicolon.
25 Missing semicolon.
40 Missing semicolon.
47 Missing semicolon.
77 Unnecessary semicolon.
82 Missing semicolon.
87 Missing semicolon.
95 Missing semicolon.
One undefined variable
13 newArray
18 newArray
34 newArray
50 newArray
Three unused variables
12 allTilesVisible
28 checkIdButton
2 filterButtons
const array = [
{ name: 'Alex1', year: 13 },
{ name: 'Alex2', year: 14 },
{ name: 'Alex3', year: 15 },
{ name: 'Alex4', year: 16 },
{ name: 'Alex5', year: 17 }
];
const result = [];
let chunkSize = 2;
for (let i=0; i < array.length; i += chunkSize) {
const chunk = array.slice(i, i + chunkSize);
result.push(chunk);
}
console.log(result);
const chunked = (data, chunkSize) =>
Array.prototype.reduce.call(
data,
(acc, n, i) => (
i = i / chunkSize | 0,
(acc[i] = acc[i] || []).push(n),
acc
),
[]
);
console.log(chunked([...Array(10).keys()], 3));
console.log(chunked('ABCDEFG', 2));
console.log(chunked(document.querySelectorAll('img'), 5));
const json = `{
"type": "widget-chart",
"title": "Handcrafted Wooden Sausages",
"data": {
"chart": {
"height": "100%",
"type": "donut"
},
"series": [
44,
55,
41,
17,
15
],
"responsive": [
{
"breakpoint": 480,
"options": {
"chart": {
"width": 200
},
"legend": {
"position": "bottom"
}
}
}
]
},
"_id": "5cf6307a245e2b001efd2111",
"id": "5cf6307a245e2b001efd2111"
}
`
console.time('eval')
let e = {}
eval('e = ' + json)
console.timeEnd('eval')
console.time('JSON.parse')
let p = {}
p = JSON.parse(json)
console.timeEnd('JSON.parse')
console.time('Function')
let f = {}
f = new Function('return ' + json)
console.timeEnd('Function')
server {
listen 443 ssl;
listen [::]:443 ssl;
access_log /var/log/nginx/api.site.ru_access.log;
ssl_certificate /etc/ssl/api.site.ru.crt;
ssl_certificate_key /etc/ssl/api.site.ru.key;
server_name api.site.ru;
root /root/api.site.ru;
gzip on;
gzip_types text/plain application/xml text/css application/javascript;
gzip_min_length 1000;
location / {
# тут заголовки и др.
proxy_pass http://127.0.0.1:3000; # Тут адрес ноды которая отдает API (уже запущенная)
}
}
nginx -t
(не забываем про сертификаты)Главная проблема - с чего начать? Можете подсказать как лучше все это организовать, какое ПО может пригодиться?
let prevX = 0;
function handleImage(e){
...
ctx.drawImage(img, prevX, 0, 300, 300)
prevX = img.width;
...
}