"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"!(_*).scss": [
"csscomb --tty-mode",
"stylelint --fix --color --config ./.stylelintrc",
"git add"
],
"*.js": [
"eslint --fix --color",
"prettier --write",
"git add"
]
},$oldTime = strtotime('10:30');
$newTime = date("H:i", strtotime('+10 minutes', $oldTime));
const grouped = Object.entries(list.reduce((acc, n) => (
(acc[n.part] = acc[n.part] || []).push(n.title),
acc
), {}));document.body.insertAdjacentHTML('beforeend', grouped
.map(([ k, v ]) => `<div>${k}</div>${v.map(n => `<div>${n}</div>`).join('')}`)
.join('')
);document.body.append(...grouped.flat(2).map(n => {
const div = document.createElement('div');
div.innerText = n;
return div;
})); const data = list.reduce((acc, {title, part}) => {
acc[part] = acc[part] || [];
acc[part].push(title);
return acc;
}, {});
Object.entries(data).forEach(([part, titles]) => {
[part, ...titles].forEach((item) => {
const div = document.createElement('div');
div.textContent = item;
document.body.appendChild(div);
});
}); subtopicList1: false,
subtopicList2: false,data-subtopic-list="subtopicList1"
onClick={handleTopicClick}onClick={e => { e.preventDefault(); handleTopicClick('subtopicList1'); }}const handleTopicClick = subtopicList => {
setSubtopicLists({
...subtopicLists,
...{ [subTopicList]: !subtopicLists[subTopicList] }
});
}; var n=prompt();
if(Number.isNaN(Number(n)))
alert('Это строка'); * {
margin: 0;
padding: 0;
}import React from 'react';
import styled from 'styled-components';
const Column = styled.div`
position: relative;
width: 100%;
padding-right: 15px;
padding-left: 15px;
`;
const columnCount = 12;
const ColumnStyled = styled(Column)`
${props => props.xs ?
`
@media (min-width: 576px) {
flex: 0 0 ${(100 / columnCount) * props.xs}%;
max-width: ${(100 / columnCount) * props.xs}%;
}
`
:
''
}
${props => props.sm ?
`
@media (min-width: 768px) {
flex: 0 0 ${(100 / columnCount) * props.sm}%;
max-width: ${(100 / columnCount) * props.sm}%;
}
`
:
''
}
${props => props.md ?
`
@media (min-width: 992px) {
flex: 0 0 ${(100 / columnCount) * props.md}%;
max-width: ${(100 / columnCount) * props.md}%;
}
`
:
''
}
${props => props.lg ?
`
@media (min-width: 1200px) {
flex: 0 0 ${(100 / columnCount) * props.lg}%;
max-width: ${(100 / columnCount) * props.lg}%;
}
`
:
''
}
`;
export default (props) => {
return (
<ColumnStyled lg={8} md={4} sm={4} xs={4}>
{ props.children }
</ColumnStyled>
)
}
s = 'Arthur Conan Doyle – The Adventures of Sherlock Holmes, George Newnes 1892'
author = s.split('–')[0].trim()
by = s.split('–')[1].trim()
last = by.lastIndexOf(' ')
book = by.slice(0, l).trim()
year = by.slice(l).trim()// Вариант 1. Привязываем контекст и первые по порядку параметры
function someFunk(a, b, event) {
console.log(a, b, event);
}
element.addEventListener('click', someFunk.bind(null, 1, 2));
// Вариант 2. Используем интерфейс EventListener
function someFunk(event) {
console.log(this.a, this.b, event);
}
element.addEventListener('click', {handleEvent: someFunk, a: 1, b: 2});