Skip to content

Commit 445ae12

Browse files
committedMar 13, 2019
deprecate substr method and use existing strip function in grammar
1 parent 5cedd62 commit 445ae12

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed
 

‎lib/handlebars/compiler/helpers.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export function SourceLocation(source, locInfo) {
2424

2525
export function id(token) {
2626
if (/^\[.*\]$/.test(token)) {
27-
return token.substr(1, token.length - 2);
27+
return token.substring(1, token.length - 1);
2828
} else {
2929
return token;
3030
}

‎src/handlebars.l

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
%{
55

66
function strip(start, end) {
7-
return yytext = yytext.substr(start, yyleng-end);
7+
return yytext = yytext.substring(start, yyleng - end + start);
88
}
99

1010
%}
@@ -59,7 +59,7 @@ ID [^\s!"#%-,\.\/;->@\[-\^`\{-~]+/{LOOKAHEAD}
5959
if (this.conditionStack[this.conditionStack.length-1] === 'raw') {
6060
return 'CONTENT';
6161
} else {
62-
yytext = yytext.substr(5, yyleng-9);
62+
strip(5, 9);
6363
return 'END_RAW_BLOCK';
6464
}
6565
}

0 commit comments

Comments
 (0)
Please sign in to comment.