Skip to content
This repository has been archived by the owner on May 19, 2023. It is now read-only.

Commit

Permalink
fix: l-for delimiter not removing whitespace correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
aidenybai committed Feb 11, 2021
1 parent 60e676d commit 6819e1c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/core/directives/for.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ export const forDirective = ({ el, data, state, node }: DirectiveProps) => {

setCustomProp(el, '__l', true);

const [expression, target] = data.value.split(/in +/g);
const [item, index] = expression.replace(parenthesisWrapReplaceRE(), '').split(',');
const currArray = state[target] as unknown[];
const [expression, target] = data.value.split(/\s+(?:in|of)\s+/gim);
const [item, index] = expression.trim().replace(parenthesisWrapReplaceRE(), '').split(',');
const currArray = state[target.trim()] as unknown[];
const ast = compile(el, state);

let template = getCustomProp(el, '__l_for_template');
Expand Down

0 comments on commit 6819e1c

Please # to comment.