Skip to content

Conversation

@dadlez
Copy link

@dadlez dadlez commented Jan 30, 2018

No description provided.

Copy link
Contributor

@Ami777 Ami777 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dobre, eleganckie rozwiązanie.

fs.readdir(path, (err, files) => {
if (!err) {
files.forEach(file => {
readContent(path + file);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Super, tak jest dużo czytalniej.

const filePath = process.argv[2];
const outputPath = './data/zadanieDnia/output.txt'

const setCase = (letter, index) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bardzo fajny podział na osobne funkcje!

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No właśnie mam wrażenie ze setCase jest już niepotrzebny przy zoptymalizowaniu kodu do jednego wiersza.

Bardziej jestem niezadowolony z pętli for, która próbowałem zastąpić: text.split().forEach((letter, index) => ...itd, ale nie wiem czemu otrzymywałem pod letter cały tekst. Czy split(’’) zadziała?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tak, split(''), bo "If separator is omitted, the array returned contains one element consisting of the entire string. If separator is an empty string, str is converted to an array of characters." (https://developer.mozilla.org/pl/docs/Web/JavaScript/Referencje/Obiekty/String/split)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants