mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-05 23:47:03 +03:00
JavaScript substr() is deprecated
This commit is contained in:
parent
04d55be625
commit
c7cf5b1c2c
2 changed files with 5 additions and 5 deletions
|
|
@ -34,7 +34,7 @@ export class IncludeCommand extends ControlCommand
|
||||||
{
|
{
|
||||||
args.forEach(arg => {
|
args.forEach(arg => {
|
||||||
if (':global' === arg || ':once' === arg || ':optional' === arg) {
|
if (':global' === arg || ':once' === arg || ':optional' === arg) {
|
||||||
this[arg.substr(1)] = true;
|
this[arg.slice(1)] = true;
|
||||||
} else if (arg instanceof GrammarQuotedString) {
|
} else if (arg instanceof GrammarQuotedString) {
|
||||||
this.value = arg;
|
this.value = arg;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -110,7 +110,7 @@ export const parseScript = (script, name = 'script.sieve') => {
|
||||||
error = message => {
|
error = message => {
|
||||||
// throw new SyntaxError(message + ' at ' + regex.lastIndex + ' line ' + line, name, line)
|
// throw new SyntaxError(message + ' at ' + regex.lastIndex + ' line ' + line, name, line)
|
||||||
throw new SyntaxError(message + ' on line ' + line
|
throw new SyntaxError(message + ' on line ' + line
|
||||||
+ ' around:\n\n' + script.substr(regex.lastIndex - 20, 30), name, line)
|
+ ' around:\n\n' + script.slice(regex.lastIndex - 20, regex.lastIndex + 10), name, line)
|
||||||
},
|
},
|
||||||
pushArg = arg => {
|
pushArg = arg => {
|
||||||
command || error('Argument not part of command');
|
command || error('Argument not part of command');
|
||||||
|
|
@ -219,7 +219,7 @@ export const parseScript = (script, name = 'script.sieve') => {
|
||||||
pushArg(GrammarMultiLine.fromString(value));
|
pushArg(GrammarMultiLine.fromString(value));
|
||||||
break;
|
break;
|
||||||
case T_QUOTED_STRING:
|
case T_QUOTED_STRING:
|
||||||
pushArg(new GrammarQuotedString(value.substr(1,value.length-2)));
|
pushArg(new GrammarQuotedString(value.slice(1,-1)));
|
||||||
break;
|
break;
|
||||||
case T_NUMBER:
|
case T_NUMBER:
|
||||||
pushArg(new GrammarNumber(value));
|
pushArg(new GrammarNumber(value));
|
||||||
|
|
@ -229,8 +229,8 @@ export const parseScript = (script, name = 'script.sieve') => {
|
||||||
case T_BRACKET_COMMENT:
|
case T_BRACKET_COMMENT:
|
||||||
case T_HASH_COMMENT: {
|
case T_HASH_COMMENT: {
|
||||||
let obj = (T_HASH_COMMENT == type)
|
let obj = (T_HASH_COMMENT == type)
|
||||||
? new GrammarHashComment(value.substr(1).trim())
|
? new GrammarHashComment(value.slice(1).trim())
|
||||||
: new GrammarBracketComment(value.substr(2, value.length-4));
|
: new GrammarBracketComment(value.slice(2, -2));
|
||||||
if (command) {
|
if (command) {
|
||||||
if (!command.comments) {
|
if (!command.comments) {
|
||||||
command.comments = [];
|
command.comments = [];
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue