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

Refactor condition expression to remove unnecessary isString function #3439

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
6 changes: 1 addition & 5 deletions src/jshint.js
Expand Up @@ -118,10 +118,6 @@ var JSHINT = (function() {
return true;
}

function isString(obj) {
return Object.prototype.toString.call(obj) === "[object String]";
}

function isIdentifier(tkn, value) {
if (!tkn)
return false;
Expand Down Expand Up @@ -6309,7 +6305,7 @@ var JSHINT = (function() {
inblock = false;
lookahead = [];

if (!isString(s) && !Array.isArray(s)) {
if (!Array.isArray(s) && typeof s !== "string") {
errorAt("E004", 0);
return false;
}
Expand Down