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

Галиакбаров Эдуард #52

Open
wants to merge 49 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
d778291
Update phone-book.js
Raseen7 Oct 23, 2018
bf7bf0b
Update phone-book.js
Raseen7 Oct 23, 2018
a57483b
Update phone-book.js
Raseen7 Oct 23, 2018
d9daa68
Update phone-book.js
Raseen7 Oct 23, 2018
eab8924
Update phone-book.js
Raseen7 Oct 23, 2018
21998db
Update phone-book.js
Raseen7 Oct 23, 2018
745ab73
Update phone-book.js
Raseen7 Oct 23, 2018
05a9ec6
Update phone-book.js
Raseen7 Oct 23, 2018
26d342c
Update phone-book.js
Raseen7 Oct 23, 2018
e305a66
Update phone-book.js
Raseen7 Oct 23, 2018
e6a826c
Update phone-book.js
Raseen7 Oct 23, 2018
1bdb6fa
Update phone-book.js
Raseen7 Oct 24, 2018
9d2501d
Update phone-book.js
Raseen7 Oct 24, 2018
84c56e0
Update phone-book.js
Raseen7 Oct 24, 2018
aa7b831
Update phone-book.js
Raseen7 Oct 24, 2018
ef57b6f
Update phone-book.js
Raseen7 Oct 24, 2018
6c1d320
Update phone-book.js
Raseen7 Oct 24, 2018
76b10e4
Update phone-book.js
Raseen7 Oct 24, 2018
a8d5be8
Update phone-book.js
Raseen7 Oct 24, 2018
f7917a2
Update phone-book.js
Raseen7 Oct 24, 2018
486686f
Update phone-book.js
Raseen7 Oct 24, 2018
05f016a
Update phone-book.js
Raseen7 Oct 24, 2018
e34131d
Update phone-book.js
Raseen7 Oct 24, 2018
04d03f4
Update phone-book.js
Raseen7 Oct 24, 2018
70cb2de
Update phone-book.js
Raseen7 Oct 24, 2018
a197316
Update phone-book.js
Raseen7 Oct 24, 2018
c8a6197
Update phone-book.js
Raseen7 Oct 24, 2018
4381f54
Update phone-book.js
Raseen7 Oct 24, 2018
63c9ff6
Update phone-book.js
Raseen7 Oct 24, 2018
db912e6
Update phone-book.js
Raseen7 Oct 24, 2018
5ef3204
Update phone-book.js
Raseen7 Oct 24, 2018
f465e8b
Update phone-book.js
Raseen7 Oct 25, 2018
1de3143
Update phone-book.js
Raseen7 Oct 25, 2018
0a7b8ac
Update phone-book.js
Raseen7 Oct 25, 2018
9d1ceff
Update phone-book.js
Raseen7 Oct 25, 2018
1ef7805
Update phone-book.js
Raseen7 Oct 25, 2018
b0c1607
Update phone-book.js
Raseen7 Oct 25, 2018
42aa6ba
Update phone-book.js
Raseen7 Oct 25, 2018
dc5be1a
Update phone-book.js
Raseen7 Oct 25, 2018
3cfd854
Update phone-book.js
Raseen7 Oct 25, 2018
7c6056e
Update phone-book.js
Raseen7 Oct 25, 2018
6949114
Update phone-book.js
Raseen7 Oct 25, 2018
a1d4a7f
Update phone-book.js
Raseen7 Oct 25, 2018
eda63e9
Update phone-book.js
Raseen7 Oct 25, 2018
04e3bc1
Update phone-book.js
Raseen7 Oct 25, 2018
0a8318f
Update phone-book.js
Raseen7 Oct 25, 2018
66d722c
Update phone-book.js
Raseen7 Oct 25, 2018
84916d2
Update phone-book.js
Raseen7 Oct 25, 2018
b081483
Add files via upload
Raseen7 Nov 11, 2018
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
Prev Previous commit
Next Next commit
Update phone-book.js
  • Loading branch information
Raseen7 authored Oct 25, 2018
commit 9d1ceffbe24747ab072bca0e67a71eab9dede714
17 changes: 13 additions & 4 deletions phone-book.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,23 @@ let phoneBook = [];
* @returns {Boolean}
*/
function isCorrectPhone(phone) {
if (phone !== undefined && typeof(phone) === 'string' && phone.length === 10) {
if (typeof phone !== undefined && typeof(phone) === 'string' && phone.length === 10) {
return true;
}

return false;
}

function isCorrectName(name) {
if (name !== undefined && typeof(name) === 'string') {
if (typeof name !== undefined && typeof(name) === 'string') {
return true;
}

return false;
}

function isCorrectEmail(email) {
if (typeof email !== undefined && typeof(email === 'string')) {
return true;
}

Expand All @@ -42,8 +50,8 @@ function recordExists(phone) {
return false;
}

function isAllArgumentsCorrect(phone, name) {
return isCorrectPhone(phone) && isCorrectName(name);
function isAllArgumentsCorrect(phone, name, email) {
return isCorrectPhone(phone) && isCorrectName(name) && isCorrectEmail(email);
}

function add(phone, name, email) {
Expand All @@ -67,6 +75,7 @@ function add(phone, name, email) {
* @param {String?} email
* @returns {Boolean}
*/

function update(phone, name, email) {
if (!isAllArgumentsCorrect(phone, name) && !recordExists(phone)) {
return false;
Expand Down