목록전체 글 (12)
신나는 개발...
https://www.sitepoint.com/currying-in-functional-javascript/ A Beginner's Guide to Currying in Functional JavaScript — SitePoint M. David Green demonstrates the concept of currying — a useful technique, to partially evaluate functions and make your functional JavaScript more readable. www.sitepoint.com More Readable And More Flexible One of the advantages touted for functional JavaScript is shor..
필요에 의해 설정파일을 사용하는 몇개의 다른 방법이 있다. 어떻게 바벨을 설정하는지 더 원한다면 상세 가이드(configure Babel)를 참조해라 이제 babel.config.json이라는 파일을 아래와 같이 만들어보자 { "presets": [ [ "@babel/env", { "targets": { "edge": "17", "firefox": "60", "chrome": "67", "safari": "11.1" } } ] ] } 이제 env preset은 오직 우리의 타겟 브라우저에서 사용이 불가능한 기능에 대한 변환 플러그인만 불러온다. 이제 폴리필을 봐보자... Polyffill 🚨 바벨 7.4.0부로 이 패키지(@babel/polyfill)는 권장되지 않고 core-js/stable과 rege..
변환은 플러그인의 코드의 변화를 어떻게 수행할지 바벨에게 지시하는 작은 자바스크립트 프로그램의 형식으로 나타난다. 심지어 원하는 변화를 적용하는 플러그인을 작성할 수 있다. ES2015+문법을 ES5로 변환할려면 공식플러그인인 @babel/plugin-transform-arrow-functions을 사용하면 된다. npm install --save-dev @babel/plugin-transform-arrow-functions ./node_modules/.bin/babel src --out-dir lib --plugins=@babel/plugin-transform-arrow-functions 이게 arrow함수는 ES5에 호환되는 함수 형식으로 바뀔거다. const fn = () => 1; // conve..
Basic usage with CLI 너가 필요하게 될 모든 바벨의 모듈은 @babel의 스코르(@babel/뭐시기를 말하는 듯 )로 npm 패키지로 발행되었다. 이 모듈은 각각의 특정 사용 케이스에 의해 설계된 다양한 툴을 염두하여 디자인되었다. Core Library 바벨의 코어기능은 @babel/core 모듈에 있다. npm install --save-dev @babel/core 자바스크립트 파일 내에서 요로케 바로 호출할 수 있다. const babel = require("@babel/core"); babel.transform("code", optionsObject); 그리고 아마 너는 인터페이스로서 @babel/core을 제공하고 개발프롤세스를 통합시키는 다른 툴을 설치하기를 원하게 될거야. 그..
https://babeljs.io/docs/en/usage Babel · The compiler for next generation JavaScript The compiler for next generation JavaScript babeljs.io 아래의 command로 babel package를 설치 : npm install --save-dev @babel/core @babel/cli @babel/preset-env npm install --save @babel/polyfill babal.config.json 의 이름으로 config파일을 생성 (프로젝트 root에 생성) { "presets": [ [ "@babel/env", { "targets": { "edge": "17", "firefox": "..
https://lodash.com/ Lodash _.defaults({ 'a': 1 }, { 'a': 3, 'b': 2 });_.partition([1, 2, 3, 4], n => n % 2);DownloadLodash is released under the MIT license & supports modern environments. Review the build differences & pick one that’s right for you.InstallationIn a browser: Using n lodash.com Why Lodash? Lodash는 array, number, objects, strings 등을ㄹ 다룰 때 번거로움을 줄여 자바스크립트를 쉽게해준다. Lodash 모듈 mthod는 이..