ReactiveX / IxJS

The Interactive Extensions for JavaScript
https://reactivex.io/IxJS/
MIT License
1.32k stars 73 forks source link

String should be iterable #276

Closed alex-kinokon closed 4 years ago

alex-kinokon commented 5 years ago

IxJS version: 2.5.3

Code to reproduce:

Ix.Iterable.from("Hello World")

Expected behavior: Returns an Iterable<string> of each character.

Actual behavior:

throw new TypeError('Input type not supported');

Additional information: Culprit is here:

function isIterable(x) {
  return exports.isObject(x) && exports.isFunction(x[Symbol.iterator]);
}
trxcllnt commented 5 years ago

ah yes. @mattpodwysocki any reason we're casting against to an object in this check? @glixlur in the meantime, you can pass the string's Iterator to Iterable.from().