chore: replace deprecated String.prototype.substr()
.substr() is deprecated so we replace it with .slice() which works similarily but isn't deprecated Signed-off-by: Tobias Speicher <rootcommander@gmail.com>
This commit is contained in:
parent
46570a4eb6
commit
c554214f33
|
|
@ -77,7 +77,7 @@ function DEFNODE(type, props, methods, base) {
|
||||||
ctor.SUBCLASSES = [];
|
ctor.SUBCLASSES = [];
|
||||||
for (var name in methods) if (HOP(methods, name)) {
|
for (var name in methods) if (HOP(methods, name)) {
|
||||||
if (/^\$/.test(name)) {
|
if (/^\$/.test(name)) {
|
||||||
ctor[name.substr(1)] = methods[name];
|
ctor[name.slice(1)] = methods[name];
|
||||||
} else {
|
} else {
|
||||||
ctor.DEFMETHOD(name, methods[name]);
|
ctor.DEFMETHOD(name, methods[name]);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -82,8 +82,8 @@ function OutputStream(options) {
|
||||||
if (typeof options.comments === "string" && /^\/.*\/[a-zA-Z]*$/.test(options.comments)) {
|
if (typeof options.comments === "string" && /^\/.*\/[a-zA-Z]*$/.test(options.comments)) {
|
||||||
var regex_pos = options.comments.lastIndexOf("/");
|
var regex_pos = options.comments.lastIndexOf("/");
|
||||||
comments = new RegExp(
|
comments = new RegExp(
|
||||||
options.comments.substr(1, regex_pos - 1),
|
options.comments.slice(1, regex_pos),
|
||||||
options.comments.substr(regex_pos + 1)
|
options.comments.slice(regex_pos + 1)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (comments instanceof RegExp) {
|
if (comments instanceof RegExp) {
|
||||||
|
|
|
||||||
|
|
@ -297,7 +297,7 @@ function tokenizer($TEXT, filename, html5_comments, shebang) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function looking_at(str) {
|
function looking_at(str) {
|
||||||
return S.text.substr(S.pos, str.length) == str;
|
return S.text.slice(S.pos, S.pos + str.length) == str;
|
||||||
}
|
}
|
||||||
|
|
||||||
function find_eol() {
|
function find_eol() {
|
||||||
|
|
@ -449,7 +449,7 @@ function tokenizer($TEXT, filename, html5_comments, shebang) {
|
||||||
var regex_allowed = S.regex_allowed;
|
var regex_allowed = S.regex_allowed;
|
||||||
var i = find_eol(), ret;
|
var i = find_eol(), ret;
|
||||||
if (i == -1) {
|
if (i == -1) {
|
||||||
ret = S.text.substr(S.pos);
|
ret = S.text.slice(S.pos);
|
||||||
S.pos = S.text.length;
|
S.pos = S.text.length;
|
||||||
} else {
|
} else {
|
||||||
ret = S.text.substring(S.pos, i);
|
ret = S.text.substring(S.pos, i);
|
||||||
|
|
@ -489,7 +489,7 @@ function tokenizer($TEXT, filename, html5_comments, shebang) {
|
||||||
}
|
}
|
||||||
if (KEYWORDS[name] && escaped) {
|
if (KEYWORDS[name] && escaped) {
|
||||||
var hex = name.charCodeAt(0).toString(16).toUpperCase();
|
var hex = name.charCodeAt(0).toString(16).toUpperCase();
|
||||||
name = "\\u" + "0000".substr(hex.length) + hex + name.slice(1);
|
name = "\\u" + "0000".slice(hex.length) + hex + name.slice(1);
|
||||||
}
|
}
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
@ -816,7 +816,7 @@ function parse($TEXT, options) {
|
||||||
function handle_regexp() {
|
function handle_regexp() {
|
||||||
if (is("operator", "/") || is("operator", "/=")) {
|
if (is("operator", "/") || is("operator", "/=")) {
|
||||||
S.peeked = null;
|
S.peeked = null;
|
||||||
S.token = S.input(S.token.value.substr(1)); // force regexp
|
S.token = S.input(S.token.value.slice(1)); // force regexp
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user