This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Promise from 'bluebird'; | |
import EventEmitter from 'eventemitter3'; | |
class InlineWorker { | |
constructor(source) { | |
if (typeof source != 'function') { | |
throw new TypeError('source must be a function'); | |
} | |
if (this._worker) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Creates a new Uint8Array based on two different ArrayBuffers | |
* | |
* @private | |
* @param {ArrayBuffers} buffer1 The first buffer. | |
* @param {ArrayBuffers} buffer2 The second buffer. | |
* @return {ArrayBuffers} The new ArrayBuffer created out of the two. | |
*/ | |
var _appendBuffer = function(buffer1, buffer2) { | |
var tmp = new Uint8Array(buffer1.byteLength + buffer2.byteLength); |
Babel은 최신 ES(2015/NEXT)
표준에 맞춰 작성된 코드를 아직 표준 기능을 구현하지 않은 브라우저와 플랫폼에서도 코드가 작동할 수 있도록 만들어주는 코드 transpiler
와 polyfill
도구의 집합입니다.
Babel 6.x 버전부턴 많은 기능이 추가되었고 운용 방식이 설정(config
) 기반 방식으로 바뀌었습니다.
만약 이전에 NPM author 정보를 설정해놓지 않았다면, 다음 명령으로 등록하세요:
npm set init.author.name "Your Name"
npm set init.author.email "[email protected]"
npm set init.author.url "http://yourblog.com"
npm adduser
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// encode | |
'foo © bar ≠ baz 𝌆 qux'.replace(/[\u{00A0}-\u{10FFFF}<>\&]/gmiu, (char) => `&#x${char.codePointAt(0).toString(16)};`); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {Suite} from 'benchmark'; | |
const suite = new Suite(); | |
suite | |
.add('Array Spread Operator', () => { | |
const a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0]; | |
const b = [...a]; | |
}) | |
.add('Array.from()', () => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.DS_Store | |
node_modules | |
npm-debug.log | |
/bin |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getYearDays(year) { | |
const isLeapYear = (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0; | |
return isLeapYear ? 366 : 365; | |
} | |
export { | |
getYearDays as default, | |
}; |
OlderNewer