어떤 순서로 찾는지 알아두면 도움이 될 때가 있습니다. 특히 모듈에서 어떤 문제가 생겨서 디
버그할 때 이런 지식이 도움이 될 수 있습니다.
직접 작성하는 모듈을
node
_
modules
에 저장해서는 안 됩니다. 그렇게 해도 모듈이 동작하
기는 하지만,
node
_
modules
디렉터리는 언제든 부담 없이 삭제하더라도
package
.
json
파
일에 기록된 의존성 리스트를 통해
npm
으로 다시 설치할 수 있다는 장점이 있습니다. 직접 만
든 모듈을
node
_
modules
디렉터리에 저장하면 삭제했을 때 되살릴 수 없습니다. 물론
npm
모듈을 직접 만들고 그 모듈을
npm
으로 관리할 수 있지만,
node
_
modules
안에 있는 내용
을 직접 수정해서는 안 됩니다.
20.4
함수 모듈을 통한 모듈 커스터마이징
모듈은 대부분 객체를 내보내지만, 이따금 함수 하나만 내보낼 때도 있습니다. 함수 하나만 내
보내는 경우는 그 모듈의 함수를 즉시 호출하려는 의도로 만들 때가 대부분입니다. 이런 경우
사용하려는 것은 그 함수가 아니라 함수의 반환값입니다(물론 반환값이 함수일 수 있습니다).
달리 말해, 모듈이 내보내는 함수가 아니라 그 함수가 반환하는 것을 쓰게 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month, and much more.
O’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
I wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
I’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
I'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.