Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: replace deprecated String.prototype.substr() #1701

Merged
merged 1 commit into from Jul 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/parse.js
Expand Up @@ -576,7 +576,7 @@ function parse(source, root, options) {
option = name;
token = peek();
if (fqTypeRefRe.test(token)) {
propName = token.substr(1); //remove '.' before property name
propName = token.slice(1); //remove '.' before property name
name += token;
next();
}
Expand Down
4 changes: 2 additions & 2 deletions src/wrappers.js
Expand Up @@ -49,7 +49,7 @@ wrappers[".google.protobuf.Any"] = {
if (type) {
// type_url does not accept leading "."
var type_url = object["@type"].charAt(0) === "." ?
object["@type"].substr(1) : object["@type"];
object["@type"].slice(1) : object["@type"];
// type_url prefix is optional, but path seperator is required
if (type_url.indexOf("/") === -1) {
type_url = "/" + type_url;
Expand Down Expand Up @@ -87,7 +87,7 @@ wrappers[".google.protobuf.Any"] = {
if (!(message instanceof this.ctor) && message instanceof Message) {
var object = message.$type.toObject(message, options);
var messageName = message.$type.fullName[0] === "." ?
message.$type.fullName.substr(1) : message.$type.fullName;
message.$type.fullName.slice(1) : message.$type.fullName;
// Default to type.googleapis.com prefix if no prefix is used
if (prefix === "") {
prefix = googleApi;
Expand Down