fix each block validation on strings (#4450)

pull/4451/head
Conduitry 6 years ago
parent a972a47e14
commit f676166060

@ -80,7 +80,7 @@ export function set_data_dev(text, data) {
} }
export function validate_each_argument(arg) { export function validate_each_argument(arg) {
if (!arg || !('length' in arg)) { if (typeof arg !== 'string' && !(arg && typeof arg === 'object' && 'length' in arg)) {
let msg = '{#each} only iterates over array-like objects.'; let msg = '{#each} only iterates over array-like objects.';
if (typeof Symbol === 'function' && arg && Symbol.iterator in arg) { if (typeof Symbol === 'function' && arg && Symbol.iterator in arg) {
msg += ' You can use a spread to convert this iterable into an array.'; msg += ' You can use a spread to convert this iterable into an array.';

Loading…
Cancel
Save