현재 열려있는 창 닫기   cmd + w

 

코드 한번에 접고 펼치기   cmd + shift + - / +

 

메소드 접고 펼치기 cmd + -/+

'잡다 > 유용한정보' 카테고리의 다른 글

데이터 직군 구별?!  (1) 2023.11.28
구글 검색방법  (0) 2023.11.14

 

사용할 제네릭(generic) 클래스의 기본 구조

Map<k,v>

 

type RoutineExerciseItemDto = {
  exerciseName: string;
  bodyPart: string;
};

type RoutineData = {
  id: number;
  name: string;
  routine: RoutineExerciseItemDto[];
};

const expampleMap = new Map<number, RoutineData>();

routineMap.set(1, {
  id: 101,
  name: "Chest Day",
  routine: [/* RoutineExerciseItemDto 객체들 */]
});

-> 1 이 key 가되고 {} 가 value 가 된다.

 

위의 exampleMap을 이용하여 파이썬의 딕션너리와 비슷하게  만들어보기 

const routines = [
  {
    id: 101,
    name: "Chest Day",
    exercises: [
      { exerciseName: "Bench Press", bodyPart: "Chest" },
      { exerciseName: "Push-up", bodyPart: "Chest" },
    ],
  },
  {
    id: 102,
    name: "Leg Day",
    exercises: [
      { exerciseName: "Squat", bodyPart: "Legs" },
      { exerciseName: "Lunge", bodyPart: "Legs" },
    ],
  },
  {
    id: 103,
    name: "Back Day",
    exercises: [
      { exerciseName: "Deadlift", bodyPart: "Back" },
      { exerciseName: "Pull-up", bodyPart: "Back" },
    ],
  }
];

// 루프를 이용한 Map 초기화
routines.forEach((routine, index) => {
  routineMap.set(index + 1, {
    id: routine.id,
    name: routine.name,
    stationary: routine.exercises,
  });
});

 

 

각 key 에 해당하는 값 불러오기

routineMap.get(1);
//  반환 값
// {
//   id: 101,
//   name: "Chest Day",
//   stationary: [...]
// }
array.every((element, index) => { return 조건; })
  • 배열의 모든 요소가 주어진 조건을 만족하면 true
  • 하나라도 만족 안하면 즉시 false 리턴

예제

const numbers = [2, 4, 6]; 
const allEven = numbers.every((num) => num % 2 === 0); // true
 
 
 

주의: 두 배열을 비교하는 경우

두 배열이 정렬되어 있어야 한다.

→ 즉, 비교를 하려는 Array1 의 순서가  Array 2의 순서대로 정렬돼 있어야만 정확히 비교됨

const array1 = [1,2,3]
const array2 = [1,2,3]

const isSame =
  array1.length === array2.length &&
  array2.every((element, index) => element === array1[index]);

repository 를 생성해서 이름을 정할때 마다 고민이 되어서 통일성 있게 하기 위해 정리

 

학습 용

prefix-[기술이름]-[옵션:추가 디테일 사항]

    • learn-   <ex> learn-typescript
      • 단순히 처음 배워보는 용도   
    • practice-    <ex> practice-nestjs-auth
      • 이미 배운 것을 실습해보는 용도
      • 이미 알고 있는 기술을 연습하거나 반복 적용
      • 개념을 학습한 후, 익히고 숙련하기 위해
  • explore-  <ex> explore-graphql 
    • 문서/공식 가이드를 따라가며 써보는 단계
    • 이거 뭔지는 아직 잘 모르는데 한번 써보는 중

프로젝트 용

개인 프로젝트

[프로젝트명] - [backend/ frontend] - [기술 프레임(express, nestjs,...)]

(ex) gymlog-backend-nestjs,  gymlog-be-nestjs 

 

학습 기반 구현 프로젝트 -  실무 예제를 따라 하거나 튜토리얼 기반으로 만든 것

 

clone-[대상 서비스 명] -[be/ fe/ full]

 

[강의 업체] - [프로젝트 명] - [기술]-[be/ fe/ full]

 

 

현재 브랜치에서

git fetch origin  # 최신 원격 정보 가져오기
git show origin/develop:README.md > README.md # 특정 파일만 가져오기

git pull # 전체 변경사항을 로컬 브랜치에 병합

+ Recent posts