분류 전체보기 486

서버에 composer 설치 방법

서버에 composer 설치방법 curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer test@webserver1:~$ composer --version Composer version 2.1.5 2021-07-23 10:35:47 root 에서에서 composer를 실행할경우 아래의 내용이 노출됨 root@webserver1:~# composer --version Do not run Composer as root/super user! See https://getcomposer.org/root for details Continue as root/super user [yes..

CI4 2021.08.10

Rest

Rest Rest 파라미터 구문은 정해지지 않은 수(an indefinite number, 부정수) 인수를 배열로 표현 =>모든값을 하나의 변수로 만들어주는것 const args = (...params) => console.log(params); //["1", 2, "a", true, Array(4), Object] args("1", 2, "a", true, [1,2,3,4], {name:"Jone", age : 25}); // 특정 KEY/VALUE 제거 const user = { name:"Jone", age:24, gender: "F" } const killGender = ({gender, ...rest}) => rest; const cleanUser = killGender(user); consol..

ES6 2021.04.01

SPREAD (전개구문)

SPREAD 전개 구문을 사용하면 배열이나 문자열과 같이 반복 가능한 문자를 0개 이상의 인수 (함수로 호출할 경우) 또는 요소 (배열 리터럴의 경우)로 확장하여, 0개 이상의 키-값의 쌍으로 객체로 확장 => 즉 변수를 가져가서 풀어해친다. console.log(...[1, 2, 3]) // 1, 2, 3 console.log(...'Hello'); // H e l l o const friends = [1, 2, 3]; const family = ['a', 'b', 'c']; console.log([friends, family]); //[Array(3), Array(3)] console.log([...friends, ...family]); //[..

ES6 2021.03.31

DESTRUCTURING [구조분해할당]

DESTRUCTURING 구조 분해 할당 구문은 배열이나 객체의 속성을 해체하여 그 값을 개별 변수에 담을 수 있게 하는 JavaScript 표현식 Object Destructuring (객체 디스트럭처링) 객체 디스트럭처링은 객체의 각 프로퍼티를 객체로부터 추출하여 변수 리스트에 할당한다. 이때 할당 기준은 키 // ES6 Destructuring const obj = { firstName: 'Jone', lastName: 'Smith' }; // 프로퍼티 키를 기준으로 디스트럭처링 할당이 이루어진다. 순서는 의미가 없다. // 변수 lastName, firstName가 선언되고 obj(initializer(초기화자))가 Destructuring(비구조화, 파괴)되어 할당된..

ES6 2021.03.31

Array.findIndex() 및 array.fill()

Array.findIndex() findIndex() 메서드는 주어진 판별 함수를 만족하는 배열의 첫 번째 요소에 대한 인덱스를 반환 const array1 = [5, 12, 8, 130, 44]; const isLargeNumber = (element) => element > 13; console.log(array1.findIndex(isLargeNumber)); // expected output: 3 Array.fill() fill() 메서드는 배열의 시작 인덱스부터 끝 인덱스의 이전까지 정적인 값 하나로 채움 const array1 = [1, 2, 3, 4]; // fill with 0 from position 2 until position 4 console.log(array1.fill(0, 2, ..

ES6 2021.03.31

Array.of() 및 Array.from()

Array.of() Array.of() 메서드는 인자의 수나 유형에 관계없이 가변 인자를 갖는 새 Array 생성 const items = Array.of("a", "b", "c"); console.log(items); // (3) ["a", "b", "c"] Array.from() Array.from() 메서드는 유사 배열 객체(array-like object)나반복 가능한 객체(iterable object)를 이용해 새 Array 생성 const m = new Map([[1, 2], [2, 4], [4, 8]]); Array.from(m); // [[1, 2], [2, 4], [4, 8]] const mapper = new Map([['1', 'a'], ['2&#3..

ES6 2021.03.31

[코드이그나이터] 아이피 별로 모드 변경하기 (development / production)

작업하다보면 development 모드와 production 모드를 분리해서 실행할 필요성이 생김 다음은 ip별로 모드를 적용하는 방법 /public/index.php 를 열어서 ... // Path to the front controller (this file) define('FCPATH', __DIR__ . DIRECTORY_SEPARATOR); // 이 부분을 입맛에 변경 및 추가 if($_SERVER['REMOTE_ADDR'] != '127.0.0.1'){ define("ENVIRONMENT","development"); } else { define("ENVIRONMENT","production"); }

CI4 2021.03.31

String 내장객체 활용

String 내장객체 활용 // String.includes() // includes() 메서드는 하나의 문자열이 다른 문자열에 포함되어 있는지를 판별하고, 결과를 true 또는 false 로 반환 const isEmail = email => email.includes("@"); console.log(isEmail("a@b")); //output : true /************************************************************************* */ // String.repeat() // repeat() 메서드는 문자열을 주어진 횟수만큼 반복해 붙인 새로운 문자열을 반환 const number = "123456"; const display = `${"*".r..

ES6 2021.03.23