Archive: 2023/10

0

structuredClone in native

structuredClone은 객체를 deep copy 하는 API 이다. 만약 structuredClone 가 Node.js의 JavaScript 영역에 구현되어있다면 Native 영역으로 구현부를 이동시킬때 유의미한 성능향상이 있을 것이다. src: implement structuredClone 은 그런면에서 흥미로운 내용일 것이라 생각하고 리뷰해보았다

0

structureClone

JavaScript에서 값을 복사할때는 항상 얕은 복사 (shallow copy)를 수행한다. 따라서 primitive data type (string, number, bigint, boolean, undefined, symbol등) 이 아닌 경우 객체의 참조로 처리된다. 얕은 복사의 반대는 깊은 복사 (deep copy)인데, 이는 복사 중 다른 객체를

0

Iteration protocols

어떤 객체가 String, Array 같이 순회 (iteration) 할 수 있는 타입이 아니더라도, JavaScript에서 순회가 가능한 (iterable) 객체로 만드는 방법이 있다. 이를 Iteration protocol 이라하며 interable, iterator 를 만드는 2개의 규칙(protocol) 을 기술하고 있다. iterable 규약에 순