Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Нужно больше функций #2

Merged
merged 1 commit into from
Feb 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,6 @@ <h2 class="success__title">Изображение успешно загруже
<template id="messages">
<div class="img-upload__message img-upload__message--loading">Загружаем...</div>
</template>

<script src="/js/functions.js"></script>
</body>
</html>
25 changes: 25 additions & 0 deletions js/functions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
function isPalindrome(str) {

Check failure on line 1 in js/functions.js

View workflow job for this annotation

GitHub Actions / Check

'isPalindrome' is defined but never used
str = str.toLowerCase().replace(/\s+/g, '');
return str === str.split('').reverse().join('');
}

function extractDigits(str) {

Check failure on line 6 in js/functions.js

View workflow job for this annotation

GitHub Actions / Check

'extractDigits' is defined but never used
const digits = str.match(/\d+/g);
if (!digits) {
return NaN;
}
const number = parseInt(digits.join(''), 10);
return number;
}

function padString(str, minLength, paddingStr) {

Check failure on line 15 in js/functions.js

View workflow job for this annotation

GitHub Actions / Check

'padString' is defined but never used
if (str.length >= minLength) {
return str;
}
const padded = paddingStr.repeat(Math.ceil(paddingLength / paddingStr.length)).slice(0, paddingLength);

Check failure on line 19 in js/functions.js

View workflow job for this annotation

GitHub Actions / Check

'paddingLength' is not defined

Check failure on line 19 in js/functions.js

View workflow job for this annotation

GitHub Actions / Check

'paddingLength' is not defined
return padded + str;
}

function checkStringLength(str, maxLength) {

Check failure on line 23 in js/functions.js

View workflow job for this annotation

GitHub Actions / Check

'checkStringLength' is defined but never used
return str.length <= maxLength;
}
Loading