MCPcopy Create free account
hub / github.com/OpenEndedGroup/Field2 / optionalidentifier

Function optionalidentifier

lib/web/jshint.js:20415–20443  ·  view source on GitHub ↗
(fnparam, prop, preserve)

Source from the content-addressed store, hash-verified

20413 // prop means that this identifier is that of an object property
20414
20415 function optionalidentifier(fnparam, prop, preserve) {
20416 if (!state.tokens.next.identifier) {
20417 return;
20418 }
20419
20420 if (!preserve) {
20421 advance();
20422 }
20423
20424 var curr = state.tokens.curr;
20425 var val = state.tokens.curr.value;
20426
20427 if (!isReserved(curr)) {
20428 return val;
20429 }
20430
20431 if (prop) {
20432 if (state.inES5()) {
20433 return val;
20434 }
20435 }
20436
20437 if (fnparam && val === "undefined") {
20438 return val;
20439 }
20440
20441 warning("W024", state.tokens.curr, state.tokens.curr.id);
20442 return val;
20443 }
20444
20445 // fnparam means that this identifier is being defined as a function
20446 // argument

Callers 3

identifierFunction · 0.85
propertyNameFunction · 0.85
jshint.jsFile · 0.85

Calls 3

isReservedFunction · 0.85
warningFunction · 0.85
advanceFunction · 0.70

Tested by

no test coverage detected