jnu-econovation / code-review-guide-wiki Goto Github PK
View Code? Open in Web Editor NEW코드리뷰 팀의 저장소
코드리뷰 팀의 저장소
데이터는 JSON 형식으로 노트의 제목, 노트의 내용으로 이루어져 있습니다. (title, body)
app.js에서 yargs를 사용해 입력 받고 handler로 function을 연결 해 주었습니다.
메서드들은 notes.js 파일에 있습니다. (addNote, removeNote, findNote, saveNote)
기존의 function syntax에서 es6 arrow function으로 바꾸는 작업을 해봤는데
잘 바꾸었는지 궁금합니다.
test
촌 수 계산 프로그램입니다.
클라이언트에서 핸드폰 번호를 입력하면, 내 친구의 핸드폰 번호를 타고 가며 몇 다리 건넌 친구인지 계산해주는 알고리즘입니다.
bfs + disjoint set 사용 했습니다.
거쳐간 친구의 경로를 출력하려고 합니다.
disjoint_set.js의 find(x)가 그 역할을 합니다.
이 method 내부에서 console을 찍으면 array 형식으로 잘 나오는데,
bfs.js에서 호출하게 되면 undefined가 찍힙니다.
class DisjointSet{
constructor(){
this.array = []
this.ret = []
}
make_set(x){
this.array[x] = x
}
union(x, y){
if(x == y) return
this.array[y] = x
}
find(x){
this.ret.push(x)
if(this.array[x] == x) {
console.log(this.ret)
return this.ret
}
this.x = this.find(this.array[x])
}
getSet(){
console.log(this.array)
}
}
exports.DisjointSet = DisjointSet
const queueUtil = require('./queue.js')
const disjointSetUtil = require('./disjoint_set.js')
const disjoint_set = new disjointSetUtil.DisjointSet()
const queue = new queueUtil.Queue()
const checked = new Set()
let flag = false
function bfs(source, target, map, callback) {
//q에 source 넣기
queue.push(source)
disjoint_set.make_set(source)
//bfs
while (!queue.empty()) {
if(flag == true){
break
}
//dequeue top
const top = queue.pop()
//map에서 dest 얻기
if (map.get(top) !== undefined) {
map.get(top).some((v) => {
//찾으면
if (v === target) {
console.log("FOUND!" + target)
flag = true
disjoint_set.make_set(v)
disjoint_set.union(top, v)
//경로 출력
//undefined가 떠요!!!
console.log(disjoint_set.find(target))
return true;
}
//set에 없으면
if (!checked.has(v)) {
//q 삽입
queue.push(v)
//disjoint 삽입
disjoint_set.make_set(v)
disjoint_set.union(top, v)
}
});
}
checked.add(top)
}
}
exports.bfs = bfs
이 코드는 카드 컴포넌트를 구현한 코드입니다. 카드의 이미지놔 컨텐츠를 각각의 컴포넌트로 구현했으며, 전역적인 상태관리를 위해서 message라는 context API를 만들어 데이더를 관리했습니다.
컨텍스트 API를 처음 사용해 보았는데, 구조를 맞게 잡았는지는 모르겠습니다. 혹시 더 좋은 방법이 있다면 알려주시면 좋을 것 같습니다.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.