Skip to content

Commit 5cbefa1

Browse files
committed
update the function so that it returns the numebr of lines rather than a full array with items in it
1 parent 4196751 commit 5cbefa1

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

  • implement-shell-tools/wc

implement-shell-tools/wc/wc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const options = program.opts();
2828
const pathInfo = await stat(path);
2929

3030
function counter(item) {
31-
const lines = item.split("\n");
31+
const lines = item.split("\n").length;
3232
const words = item.split(/\s+/).filter(Boolean).length;
3333
const characters = item.length;
3434
return { lines, words, characters };

0 commit comments

Comments
 (0)