Skip to content

Commit

Permalink
fix each block validation on strings (sveltejs#4450)
Browse files Browse the repository at this point in the history
  • Loading branch information
Conduitry committed Feb 23, 2020
1 parent a972a47 commit f676166
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/runtime/internal/dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export function set_data_dev(text, data) {
}

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.';
if (typeof Symbol === 'function' && arg && Symbol.iterator in arg) {
msg += ' You can use a spread to convert this iterable into an array.';
Expand Down

0 comments on commit f676166

Please sign in to comment.