mathiasbynens / Array.from

A robust & optimized ES3-compatible polyfill for the `Array.from` method in ECMAScript 6.

Home Page:https://mths.be/array-from

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Splits astral symbol into surrogate pairs

MadLittleMods opened this issue Β· comments

The polyfill splits each unicode character(astral symbol) into their surrogate pairs while the native implementation keeps them intact.

var arrayFrom = require('array.from');

// ["πŸ–", "🏿"]
const nativeResult = Array.from('πŸ–πŸΏ');
// ["οΏ½", "οΏ½", "οΏ½", "οΏ½"]
const polyfillResult = arrayFrom('πŸ–πŸΏ');
console.log(nativeResult, polyfillResult);

https://runkit.com/madlittlemods/58aaa693808777001350cf41


Relevant issues,

This works with the latest from the repo.

I suspect #33 fixed things up. Thanks @falsandtru πŸ˜€

@ljharb Friendly ping for timeline/todos on next npm release?

There's a bit of work to do before the master branch is ready for release. It likely won't be super soon.

v1.1.0 is now released which should contain all the latest fixes, and will iterate properly in every version of every engine.