File jsx-transformer-0.12.2.js
has 10992 lines of code (exceeds 250 allowed). Consider refactoring.
* JSXTransformer v0.12.2
*/
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.JSXTransformer=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
Function 9
has 6131 lines of code (exceeds 25 allowed). Consider refactoring.
},{}],9:[function(_dereq_,module,exports){
Copyright (C) 2013 Ariya Hidayat <ariya.hidayat@gmail.com>
Copyright (C) 2013 Thaddee Tyl <thaddee.tyl@gmail.com>
Copyright (C) 2012 Ariya Hidayat <ariya.hidayat@gmail.com>
Function 2
has 840 lines of code (exceeds 25 allowed). Consider refactoring.
},{"./fbtransform/visitors":37,"buffer":2,"jstransform":21,"jstransform/visitors/type-syntax":33}],2:[function(_dereq_,module,exports){
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
Function 24
has 383 lines of code (exceeds 25 allowed). Consider refactoring.
},{"../src/utils":22,"./es6-destructuring-visitors":25,"./es6-rest-param-visitors":28,"esprima-fb":9}],24:[function(_dereq_,module,exports){
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
Function 22
has 311 lines of code (exceeds 25 allowed). Consider refactoring.
},{"./utils":22,"esprima-fb":9,"source-map":10}],22:[function(_dereq_,module,exports){
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
Function 15
has 268 lines of code (exceeds 25 allowed). Consider refactoring.
},{"amdefine":19}],15:[function(_dereq_,module,exports){
* Copyright 2011 Mozilla Foundation and contributors
* Licensed under the New BSD license. See LICENSE or:
Function 16
has 257 lines of code (exceeds 25 allowed). Consider refactoring.
},{"./array-set":11,"./base64-vlq":12,"./binary-search":14,"./util":18,"amdefine":19}],16:[function(_dereq_,module,exports){
* Copyright 2011 Mozilla Foundation and contributors
* Licensed under the New BSD license. See LICENSE or:
Function 17
has 247 lines of code (exceeds 25 allowed). Consider refactoring.
},{"./array-set":11,"./base64-vlq":12,"./util":18,"amdefine":19}],17:[function(_dereq_,module,exports){
* Copyright 2011 Mozilla Foundation and contributors
* Licensed under the New BSD license. See LICENSE or:
Function 36
has 209 lines of code (exceeds 25 allowed). Consider refactoring.
},{"jstransform":21,"jstransform/src/utils":22}],36:[function(_dereq_,module,exports){
* Copyright 2013-2014, Facebook, Inc.
* All rights reserved.
*
Function 1
has 200 lines of code (exceeds 25 allowed). Consider refactoring.
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.JSXTransformer=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
* Copyright 2013-2014, Facebook, Inc.
* All rights reserved.
*
Function 19
has 191 lines of code (exceeds 25 allowed). Consider refactoring.
},{"amdefine":19}],19:[function(_dereq_,module,exports){
(function (process,__filename){
* @license amdefine 0.1.0 Copyright (c) 2011, The Dojo Foundation All Rights Reserved.
* Available via the MIT or new BSD license.
Function amdefine
has 184 lines of code (exceeds 25 allowed). Consider refactoring.
function amdefine(module, requireFn) {
'use strict';
var defineCache = {},
loaderCache = {},
alreadyCalled = false,
Function 21
has 175 lines of code (exceeds 25 allowed). Consider refactoring.
},{}],21:[function(_dereq_,module,exports){
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
Function scanPunctuator
has 171 lines of code (exceeds 25 allowed). Consider refactoring.
function scanPunctuator() {
var start = index,
code = source.charCodeAt(index),
code2,
ch1 = source[index],
Function 25
has 165 lines of code (exceeds 25 allowed). Consider refactoring.
},{"../src/utils":22,"./reserved-words-helper":32,"base62":8,"esprima-fb":9}],25:[function(_dereq_,module,exports){
* Copyright 2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
Function 34
has 160 lines of code (exceeds 25 allowed). Consider refactoring.
},{"../src/utils":22,"esprima-fb":9}],34:[function(_dereq_,module,exports){
* Copyright 2013-2014, Facebook, Inc.
* All rights reserved.
*
Function 6
has 143 lines of code (exceeds 25 allowed). Consider refactoring.
},{}],6:[function(_dereq_,module,exports){
(function (process){
Function visitReactTag
has 136 lines of code (exceeds 25 allowed). Consider refactoring.
function visitReactTag(traverse, object, path, state) {
var openingElement = object.openingElement;
var nameObject = openingElement.name;
var attributesObject = openingElement.attributes;
Function parseObjectProperty
has 135 lines of code (exceeds 25 allowed). Consider refactoring.
function parseObjectProperty() {
var token, key, id, value, param, expr, computed,
marker = markerCreate(), returnType;
token = lookahead;
Function 18
has 134 lines of code (exceeds 25 allowed). Consider refactoring.
},{"./source-map-generator":16,"./util":18,"amdefine":19}],18:[function(_dereq_,module,exports){
* Copyright 2011 Mozilla Foundation and contributors
* Licensed under the New BSD license. See LICENSE or:
Function 33
has 119 lines of code (exceeds 25 allowed). Consider refactoring.
},{}],33:[function(_dereq_,module,exports){
var esprima = _dereq_('esprima-fb');
var utils = _dereq_('../src/utils');
var Syntax = esprima.Syntax;
Function scanComment
has 117 lines of code (exceeds 25 allowed). Consider refactoring.
function scanComment() {
var comment, ch, loc, start, blockComment, lineComment;
comment = '';
blockComment = false;
Function scanTemplate
has 110 lines of code (exceeds 25 allowed). Consider refactoring.
function scanTemplate() {
var cooked = '', ch, start, terminated, tail, restore, unescaped, code, octal;
terminated = false;
tail = false;
Function scanRegExp
has 105 lines of code (exceeds 25 allowed). Consider refactoring.
function scanRegExp() {
var str, ch, start, pattern, flags, value, classMarker = false, restore, terminated = false, tmp;
lookahead = null;
skipComment();
Function 29
has 96 lines of code (exceeds 25 allowed). Consider refactoring.
},{"../src/utils":22,"esprima-fb":9}],29:[function(_dereq_,module,exports){
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
Function parseMethodDefinition
has 95 lines of code (exceeds 25 allowed). Consider refactoring.
function parseMethodDefinition(existingPropNames, key, isStatic, generator, computed) {
var token, param, propType, isValidDuplicateProp = false,
isAsync, typeParameters, tokenValue, returnType,
annotationMarker;
Function scanStringLiteral
has 94 lines of code (exceeds 25 allowed). Consider refactoring.
function scanStringLiteral() {
var str = '', quote, start, ch, code, unescaped, restore, octal = false;
quote = source[index];
assert((quote === '\'' || quote === '"'),
Function parsePrimaryType
has 91 lines of code (exceeds 25 allowed). Consider refactoring.
function parsePrimaryType() {
var typeIdentifier = null, params = null, returnType = null,
marker = markerCreate(), rest = null, tmp,
typeParameters, token, type, isGroupedType = false;
Function 3
has 90 lines of code (exceeds 25 allowed). Consider refactoring.
},{"base64-js":3,"ieee754":4,"is-array":5}],3:[function(_dereq_,module,exports){
var lookup = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
;(function (exports) {
'use strict';
Function parse
has 84 lines of code (exceeds 25 allowed). Consider refactoring.
function parse(code, options) {
var program, toString;
toString = String;
if (typeof code !== 'string' && !(code instanceof String)) {
Function scanNumericLiteral
has 84 lines of code (exceeds 25 allowed). Consider refactoring.
function scanNumericLiteral() {
var number, start, ch, octal;
ch = source[index];
assert(isDecimalDigit(ch.charCodeAt(0)) || (ch === '.'),
Function 23
has 81 lines of code (exceeds 25 allowed). Consider refactoring.
},{"./docblock":20,"esprima-fb":9}],23:[function(_dereq_,module,exports){
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
Function tokenize
has 80 lines of code (exceeds 25 allowed). Consider refactoring.
function tokenize(code, options) {
var toString,
token,
tokens;
Function visitClassFunctionExpression
has 80 lines of code (exceeds 25 allowed). Consider refactoring.
function visitClassFunctionExpression(traverse, node, path, state) {
var methodNode = path[0];
var isGetter = methodNode.kind === 'get';
var isSetter = methodNode.kind === 'set';
Function 37
has 77 lines of code (exceeds 25 allowed). Consider refactoring.
},{"jstransform":21,"jstransform/src/utils":22}],37:[function(_dereq_,module,exports){
var es6ArrowFunctions = _dereq_('jstransform/visitors/es6-arrow-function-visitors');
var es6Classes = _dereq_('jstransform/visitors/es6-class-visitors');
var es6Destructuring = _dereq_('jstransform/visitors/es6-destructuring-visitors');
Function parseExportDeclaration
has 74 lines of code (exceeds 25 allowed). Consider refactoring.
function parseExportDeclaration() {
var backtrackToken, id, previousAllowKeyword, declaration = null,
isExportFromIdentifier,
src = null, specifiers = [],
marker = markerCreate();
Function parseStatement
has 74 lines of code (exceeds 25 allowed). Consider refactoring.
function parseStatement() {
var type = lookahead.type,
marker,
expr,
labeledBody,
Function 4
has 73 lines of code (exceeds 25 allowed). Consider refactoring.
},{}],4:[function(_dereq_,module,exports){
exports.read = function(buffer, offset, isLE, mLen, nBytes) {
var e, m,
eLen = nBytes * 8 - mLen - 1,
eMax = (1 << eLen) - 1,
Function parseForStatement
has 72 lines of code (exceeds 25 allowed). Consider refactoring.
function parseForStatement(opts) {
var init, test, update, left, right, body, operator, oldInIteration,
marker = markerCreate();
init = test = update = null;
expectKeyword('for');
Function parseFunctionExpression
has 71 lines of code (exceeds 25 allowed). Consider refactoring.
function parseFunctionExpression() {
var token, id = null, firstRestricted, message, tmp, body, generator, isAsync,
previousStrict, previousYieldAllowed, previousAwaitAllowed,
marker = markerCreate(), typeParameters;
Function 7
has 69 lines of code (exceeds 25 allowed). Consider refactoring.
},{"_process":7}],7:[function(_dereq_,module,exports){
var process = module.exports = {};
Function skipComment
has 68 lines of code (exceeds 25 allowed). Consider refactoring.
function skipComment() {
var ch, blockComment, lineComment;
blockComment = false;
lineComment = false;
Function parseFunctionDeclaration
has 67 lines of code (exceeds 25 allowed). Consider refactoring.
function parseFunctionDeclaration() {
var id, body, token, tmp, firstRestricted, message, generator, isAsync,
previousStrict, previousYieldAllowed, previousAwaitAllowed,
marker = markerCreate(), typeParameters;
Function traverse
has 65 lines of code (exceeds 25 allowed). Consider refactoring.
function traverse(node, path, state) {
var parentNode = path[0];
if (!Array.isArray(node) && state.localScope.parentNode !== parentNode) {
Function parseAssignmentExpression
has 64 lines of code (exceeds 25 allowed). Consider refactoring.
function parseAssignmentExpression() {
var marker, expr, token, params, oldParenthesizedCount,
backtrackToken = lookahead, possiblyAsync = false;
if (matchYield()) {
Function _renderClassBody
has 63 lines of code (exceeds 25 allowed). Consider refactoring.
function _renderClassBody(traverse, node, path, state) {
var className = state.className;
var superClass = state.superClass;
Function parsePrimaryExpression
has 63 lines of code (exceeds 25 allowed). Consider refactoring.
function parsePrimaryExpression() {
var marker, type, token, expr;
type = lookahead.type;
Function SourceNode_fromStringWithSourceMap
has 62 lines of code (exceeds 25 allowed). Consider refactoring.
function SourceNode_fromStringWithSourceMap(aGeneratedCode, aSourceMapConsumer) {
var node = new SourceNode();
Function SourceNode_toStringWithSourceMap
has 61 lines of code (exceeds 25 allowed). Consider refactoring.
SourceNode.prototype.toStringWithSourceMap = function SourceNode_toStringWithSourceMap(aArgs) {
var generated = {
code: "",
line: 1,
column: 0
Function SourceMapConsumer_parseMappings
has 60 lines of code (exceeds 25 allowed). Consider refactoring.
function SourceMapConsumer_parseMappings(aStr, aSourceRoot) {
var generatedLine = 1;
var previousGeneratedColumn = 0;
var previousOriginalLine = 0;
var previousOriginalColumn = 0;
Consider simplifying this complex logical expression.
else if (aGenerated && 'line' in aGenerated && 'column' in aGenerated
&& aOriginal && 'line' in aOriginal && 'column' in aOriginal
&& aGenerated.line > 0 && aGenerated.column >= 0
&& aOriginal.line > 0 && aOriginal.column >= 0
&& aSource) {
Function 31
has 57 lines of code (exceeds 25 allowed). Consider refactoring.
},{"../src/utils":22,"esprima-fb":9}],31:[function(_dereq_,module,exports){
* Copyright 2004-present Facebook. All Rights Reserved.
*/
Function 12
has 57 lines of code (exceeds 25 allowed). Consider refactoring.
},{"./util":18,"amdefine":19}],12:[function(_dereq_,module,exports){
* Copyright 2011 Mozilla Foundation and contributors
* Licensed under the New BSD license. See LICENSE or:
Function 28
has 56 lines of code (exceeds 25 allowed). Consider refactoring.
},{"../src/utils":22,"esprima-fb":9}],28:[function(_dereq_,module,exports){
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
Function loadScripts
has 56 lines of code (exceeds 25 allowed). Consider refactoring.
function loadScripts(scripts) {
var result = [];
var count = scripts.length;
function check() {
Function parseArrayInitialiser
has 55 lines of code (exceeds 25 allowed). Consider refactoring.
function parseArrayInitialiser() {
var elements = [], blocks = [], filter = null, tmp, possiblecomprehension = true, body,
marker = markerCreate();
expect('[');
Function binaryPrecedence
has 54 lines of code (exceeds 25 allowed). Consider refactoring.
function binaryPrecedence(token, allowIn) {
var prec = 0;
if (token.type !== Token.Punctuator && token.type !== Token.Keyword) {
return 0;
Function 35
has 54 lines of code (exceeds 25 allowed). Consider refactoring.
},{"./xjs":36,"jstransform":21,"jstransform/src/utils":22}],35:[function(_dereq_,module,exports){
* Copyright 2013-2014, Facebook, Inc.
* All rights reserved.
*
Function parseFunctionSourceElements
has 53 lines of code (exceeds 25 allowed). Consider refactoring.
function parseFunctionSourceElements() {
var sourceElement, sourceElements = [], token, directive, firstRestricted,
oldLabelSet, oldInIteration, oldInSwitch, oldInFunctionBody, oldParenthesizedCount,
marker = markerCreate();
Function parseParam
has 52 lines of code (exceeds 25 allowed). Consider refactoring.
function parseParam(options) {
var marker, token, rest, param, def;
token = lookahead;
if (token.value === '...') {
Function write
has 50 lines of code (exceeds 25 allowed). Consider refactoring.
Buffer.prototype.write = function (string, offset, length, encoding) {
if (isFinite(offset)) {
if (!isFinite(length)) {
Function parseObjectType
has 50 lines of code (exceeds 25 allowed). Consider refactoring.
function parseObjectType(allowStatic) {
var callProperties = [], indexers = [], marker, optional = false,
properties = [], property, propertyKey, propertyTypeAnnotation,
token, isStatic;
Function SourceMapGenerator_applySourceMap
has 48 lines of code (exceeds 25 allowed). Consider refactoring.
function SourceMapGenerator_applySourceMap(aSourceMapConsumer, aSourceFile) {
if (!aSourceFile) {
aSourceFile = aSourceMapConsumer.file;
}
Function reinterpretAsCoverFormalsList
has 48 lines of code (exceeds 25 allowed). Consider refactoring.
function reinterpretAsCoverFormalsList(expressions) {
var i, len, param, params, defaults, defaultCount, options, rest;
params = [];
defaults = [];
Function 30
has 48 lines of code (exceeds 25 allowed). Consider refactoring.
},{"../src/utils":22,"esprima-fb":9}],30:[function(_dereq_,module,exports){
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
Function nextTick
has 47 lines of code (exceeds 25 allowed). Consider refactoring.
process.nextTick = (function () {
var canSetImmediate = typeof window !== 'undefined'
&& window.setImmediate;
var canMutationObserver = typeof window !== 'undefined'
&& window.MutationObserver;
Function SourceMapGenerator_serializeMappings
has 47 lines of code (exceeds 25 allowed). Consider refactoring.
function SourceMapGenerator_serializeMappings() {
var previousGeneratedColumn = 0;
var previousGeneratedLine = 1;
var previousOriginalColumn = 0;
var previousOriginalLine = 0;
Function advance
has 47 lines of code (exceeds 25 allowed). Consider refactoring.
function advance() {
var ch;
if (!state.inXJSChild) {
skipComment();
Function 11
has 47 lines of code (exceeds 25 allowed). Consider refactoring.
},{"./source-map/source-map-consumer":15,"./source-map/source-map-generator":16,"./source-map/source-node":17}],11:[function(_dereq_,module,exports){
* Copyright 2011 Mozilla Foundation and contributors
* Licensed under the New BSD license. See LICENSE or:
Function _augment
has 46 lines of code (exceeds 25 allowed). Consider refactoring.
Buffer._augment = function (arr) {
arr.constructor = Buffer
arr._isBuffer = true
Function advanceSlash
has 46 lines of code (exceeds 25 allowed). Consider refactoring.
function advanceSlash() {
var prevToken,
checkToken;
Function Buffer
has 46 lines of code (exceeds 25 allowed). Consider refactoring.
function Buffer (subject, encoding, noZero) {
if (!(this instanceof Buffer))
return new Buffer(subject, encoding, noZero)
var type = typeof subject
Function parseBinaryExpression
has 46 lines of code (exceeds 25 allowed). Consider refactoring.
function parseBinaryExpression() {
var expr, token, prec, previousAllowIn, stack, right, operator, left, i,
marker, markers;
previousAllowIn = state.allowIn;
Function renderXJSLiteral
has 45 lines of code (exceeds 25 allowed). Consider refactoring.
function renderXJSLiteral(object, isLast, state, start, end) {
var lines = object.value.split(/\r\n|\n|\r/);
if (start) {
utils.append(start, state);
Function 20
has 43 lines of code (exceeds 25 allowed). Consider refactoring.
},{"_process":7,"path":6}],20:[function(_dereq_,module,exports){
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
Function write
has 43 lines of code (exceeds 25 allowed). Consider refactoring.
exports.write = function(buffer, value, offset, isLE, mLen, nBytes) {
var e, m, c,
eLen = nBytes * 8 - mLen - 1,
eMax = (1 << eLen) - 1,
eBias = eMax >> 1,
Consider simplifying this complex logical expression.
if (object &&
object.type === Syntax.CallExpression &&
object.callee.type === Syntax.MemberExpression &&
object.callee.object.type === Syntax.Identifier &&
object.callee.object.name === 'React' &&
Function processComment
has 41 lines of code (exceeds 25 allowed). Consider refactoring.
function processComment(node) {
var lastChild,
trailingComments,
bottomRight = extra.bottomRightStack,
last = bottomRight[bottomRight.length - 1];
Function parseObjectInitialiser
has 41 lines of code (exceeds 25 allowed). Consider refactoring.
function parseObjectInitialiser() {
var properties = [], property, name, key, kind, map = {}, toString = String,
marker = markerCreate();
expect('{');
Function parseSourceElement
has 39 lines of code (exceeds 25 allowed). Consider refactoring.
function parseSourceElement() {
var token;
if (lookahead.type === Token.Keyword) {
switch (lookahead.value) {
case 'const':
Function reinterpretAsAssignmentBindingPattern
has 39 lines of code (exceeds 25 allowed). Consider refactoring.
function reinterpretAsAssignmentBindingPattern(expr) {
var i, len, property, element;
if (expr.type === Syntax.ObjectExpression) {
expr.type = Syntax.ObjectPattern;
Function parseExpression
has 37 lines of code (exceeds 25 allowed). Consider refactoring.
function parseExpression() {
var marker, expr, expressions, sequence, coverFormalsList, spreadFound, oldParenthesizedCount;
oldParenthesizedCount = state.parenthesizedCount;
Function visitTaggedTemplateExpression
has 37 lines of code (exceeds 25 allowed). Consider refactoring.
function visitTaggedTemplateExpression(traverse, node, path, state) {
var template = node.quasi;
var numQuasis = template.quasis.length;
Function transformCode
has 37 lines of code (exceeds 25 allowed). Consider refactoring.
function transformCode(code, url, options) {
try {
var transformed = transformReact(code, options);
} catch(e) {
e.message += '\n at ';
Function visitTemplateLiteral
has 37 lines of code (exceeds 25 allowed). Consider refactoring.
function visitTemplateLiteral(traverse, node, path, state) {
var templateElements = node.quasis;
utils.append('(', state);
for (var ii = 0; ii < templateElements.length; ii++) {
Function getDestructuredComponents
has 35 lines of code (exceeds 25 allowed). Consider refactoring.
function getDestructuredComponents(node, state) {
var tmpIndex = state.localScope.tempVarIndex;
var components = [];
var patternItems = getPatternItems(node);
Function catchup
has 35 lines of code (exceeds 25 allowed). Consider refactoring.
function catchup(end, state, contentTransformer) {
if (end < state.g.position) {
return;
}
Function parseDeclareModule
has 35 lines of code (exceeds 25 allowed). Consider refactoring.
function parseDeclareModule() {
var body = [], bodyMarker, id, idMarker, marker = markerCreate(), token;
expectContextualKeyword('declare');
expectContextualKeyword('module');
Function getEscapedIdentifier
has 35 lines of code (exceeds 25 allowed). Consider refactoring.
function getEscapedIdentifier() {
var ch, id;
ch = source.charCodeAt(index++);
id = String.fromCharCode(ch);
Function parseVariableDeclaration
has 35 lines of code (exceeds 25 allowed). Consider refactoring.
function parseVariableDeclaration(kind) {
var id,
marker = markerCreate(),
init = null,
typeAnnotationMarker = markerCreate();
Function visitObjectLiteralSpread
has 35 lines of code (exceeds 25 allowed). Consider refactoring.
function visitObjectLiteralSpread(traverse, node, path, state) {
utils.catchup(node.range[0], state);
utils.append('Object.assign({', state);
Function runFactory
has 34 lines of code (exceeds 25 allowed). Consider refactoring.
function runFactory(id, deps, factory) {
var r, e, m, result;
if (id) {
e = loaderCache[id] = {};
Function SourceMapGenerator_fromSourceMap
has 34 lines of code (exceeds 25 allowed). Consider refactoring.
function SourceMapGenerator_fromSourceMap(aSourceMapConsumer) {
var sourceRoot = aSourceMapConsumer.sourceRoot;
var generator = new SourceMapGenerator({
file: aSourceMapConsumer.file,
sourceRoot: sourceRoot
Function 26
has 34 lines of code (exceeds 25 allowed). Consider refactoring.
},{"../src/utils":22,"./es6-rest-param-visitors":28,"./es7-rest-property-helpers":30,"./reserved-words-helper":32,"esprima-fb":9}],26:[function(_dereq_,module,exports){
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
Function visitSuperCallExpression
has 34 lines of code (exceeds 25 allowed). Consider refactoring.
function visitSuperCallExpression(traverse, node, path, state) {
var superClassName = state.superClass.name;
if (node.callee.type === Syntax.Identifier) {
if (_isConstructorMethod(state.methodNode)) {
Function collectToken
has 34 lines of code (exceeds 25 allowed). Consider refactoring.
function collectToken() {
var start, loc, token, range, value, entry;
if (!state.inXJSChild) {
skipComment();
Consider simplifying this complex logical expression.
if (aGenerated && 'line' in aGenerated && 'column' in aGenerated
&& aGenerated.line > 0 && aGenerated.column >= 0
&& !aOriginal && !aSource && !aName) {
return;
Function parseUnaryExpression
has 33 lines of code (exceeds 25 allowed). Consider refactoring.
function parseUnaryExpression() {
var marker, token, expr;
if (lookahead.type !== Token.Punctuator && lookahead.type !== Token.Keyword) {
return parsePostfixExpression();
Function reinterpretAsDestructuredParameter
has 32 lines of code (exceeds 25 allowed). Consider refactoring.
function reinterpretAsDestructuredParameter(options, expr) {
var i, len, property, element;
if (expr.type === Syntax.ObjectExpression) {
expr.type = Syntax.ObjectPattern;
Function toString
has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Buffer.prototype.toString = function (encoding, start, end) {
var loweredCase = false
start = start >>> 0
end = end === undefined || end === Infinity ? this.length : end >>> 0
Function createState
has 32 lines of code (exceeds 25 allowed). Consider refactoring.
function createState(source, rootNode, transformOptions) {
return {
* A tree representing the current local scope (and its lexical scope chain)
* Useful for tracking identifiers from parent scopes, etc.
Function parseDeclareFunction
has 32 lines of code (exceeds 25 allowed). Consider refactoring.
function parseDeclareFunction() {
var id, idMarker,
marker = markerCreate(), params, returnType, rest, tmp,
typeParameters = null, value, valueMarker;
Function collectRegex
has 32 lines of code (exceeds 25 allowed). Consider refactoring.
function collectRegex() {
var pos, loc, regex, token;
skipComment();
Function createFunctionExpression
has 10 arguments (exceeds 4 allowed). Consider refactoring.
createFunctionExpression: function (id, params, defaults, body, rest, generator, expression,
isAsync, returnType, typeParameters) {
Function createFunctionDeclaration
has 10 arguments (exceeds 4 allowed). Consider refactoring.
createFunctionDeclaration: function (id, params, defaults, body, rest, generator, expression,
isAsync, returnType, typeParameters) {
Function 14
has 31 lines of code (exceeds 25 allowed). Consider refactoring.
},{"amdefine":19}],14:[function(_dereq_,module,exports){
* Copyright 2011 Mozilla Foundation and contributors
* Licensed under the New BSD license. See LICENSE or:
Function parseProgramElements
has 31 lines of code (exceeds 25 allowed). Consider refactoring.
function parseProgramElements() {
var sourceElement, sourceElements = [], token, directive, firstRestricted;
while (index < length) {
token = lookahead;
Function parseClassExpression
has 30 lines of code (exceeds 25 allowed). Consider refactoring.
function parseClassExpression() {
var id, implemented, previousYieldAllowed, superClass = null,
superTypeParameters, marker = markerCreate(), typeParameters;
expectKeyword('class');
Function uint8ToBase64
has 30 lines of code (exceeds 25 allowed). Consider refactoring.
function uint8ToBase64 (uint8) {
var i,
extraBytes = uint8.length % 3,
output = "",
temp, length
Function relative
has 30 lines of code (exceeds 25 allowed). Consider refactoring.
exports.relative = function(from, to) {
from = exports.resolve(from).substr(1);
to = exports.resolve(to).substr(1);
function trim(arr) {
Function scanXJSText
has 30 lines of code (exceeds 25 allowed). Consider refactoring.
function scanXJSText(stopChars) {
var ch, str = '', start;
start = index;
while (index < length) {
ch = source[index];
Function parseSwitchStatement
has 30 lines of code (exceeds 25 allowed). Consider refactoring.
function parseSwitchStatement() {
var discriminant, cases, clause, oldInSwitch, defaultFound, marker = markerCreate();
expectKeyword('switch');
Function slice
has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Buffer.prototype.slice = function (start, end) {
var len = this.length
start = ~~start
end = end === undefined ? len : ~~end
Function scanOctalLiteral
has 29 lines of code (exceeds 25 allowed). Consider refactoring.
function scanOctalLiteral(prefix, start) {
var number, octal;
if (isOctalDigit(prefix)) {
octal = true;
Function parsePropertyFunction
has 28 lines of code (exceeds 25 allowed). Consider refactoring.
function parsePropertyFunction(options) {
var previousStrict, previousYieldAllowed, previousAwaitAllowed,
params, defaults, body, marker = markerCreate();
previousStrict = strict;
Function SourceMapConsumer_eachMapping
has 28 lines of code (exceeds 25 allowed). Consider refactoring.
function SourceMapConsumer_eachMapping(aCallback, aContext, aOrder) {
var context = aContext || null;
var order = aOrder || SourceMapConsumer.GENERATED_ORDER;
var mappings;
Function isKeyword
has 28 lines of code (exceeds 25 allowed). Consider refactoring.
function isKeyword(id) {
if (strict && isStrictModeReservedWord(id)) {
return true;
}
Function parseClassDeclaration
has 28 lines of code (exceeds 25 allowed). Consider refactoring.
function parseClassDeclaration() {
var id, implemented, previousYieldAllowed, superClass = null,
superTypeParameters, marker = markerCreate(), typeParameters;
expectKeyword('class');
Function transform
has 28 lines of code (exceeds 25 allowed). Consider refactoring.
function transform(visitors, source, options) {
options = options || {};
var ast;
try {
var cachedAst = _astCache[source];
Function byteLength
has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Buffer.byteLength = function (str, encoding) {
var ret
str = str + ''
switch (encoding || 'utf8') {
case 'ascii':
Function parseImportDeclaration
has 27 lines of code (exceeds 25 allowed). Consider refactoring.
function parseImportDeclaration() {
var specifiers, src, marker = markerCreate();
expectKeyword('import');
specifiers = [];
Function parseContinueStatement
has 27 lines of code (exceeds 25 allowed). Consider refactoring.
function parseContinueStatement() {
var label = null, key, marker = markerCreate();
expectKeyword('continue');
Function scanXJSEntity
has 27 lines of code (exceeds 25 allowed). Consider refactoring.
function scanXJSEntity() {
var ch, str = '', start = index, count = 0, code;
ch = source[index];
assert(ch === '&', 'Entity must start with an ampersand');
index++;
Function visitArrowFunction
has 27 lines of code (exceeds 25 allowed). Consider refactoring.
function visitArrowFunction(traverse, node, path, state) {
var notInExpression = (path[0].type === Syntax.ExpressionStatement);
Function b64ToByteArray
has 27 lines of code (exceeds 25 allowed). Consider refactoring.
function b64ToByteArray (b64) {
var i, j, l, tmp, placeHolders, arr
if (b64.length % 4 > 0) {
throw new Error('Invalid string. Length must be a multiple of 4')
Function 32
has 27 lines of code (exceeds 25 allowed). Consider refactoring.
},{"../src/utils":22,"esprima-fb":9}],32:[function(_dereq_,module,exports){
* Copyright 2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
Function parseBreakStatement
has 27 lines of code (exceeds 25 allowed). Consider refactoring.
function parseBreakStatement() {
var label = null, key, marker = markerCreate();
expectKeyword('break');
Function SourceMapConsumer_originalPositionFor
has 27 lines of code (exceeds 25 allowed). Consider refactoring.
function SourceMapConsumer_originalPositionFor(aArgs) {
var needle = {
generatedLine: util.getArg(aArgs, 'line'),
generatedColumn: util.getArg(aArgs, 'column')
};
Function read
has 26 lines of code (exceeds 25 allowed). Consider refactoring.
exports.read = function(buffer, offset, isLE, mLen, nBytes) {
var e, m,
eLen = nBytes * 8 - mLen - 1,
eMax = (1 << eLen) - 1,
eBias = eMax >> 1,
Function parseParams
has 26 lines of code (exceeds 25 allowed). Consider refactoring.
function parseParams(firstRestricted) {
var options, marker = markerCreate();
options = {
params: [],
Function parseClassElement
has 26 lines of code (exceeds 25 allowed). Consider refactoring.
function parseClassElement(existingProps) {
var computed, generator = false, key, marker = markerCreate(),
isStatic = false;
if (match(';')) {
lex();
Function createClassExpression
has 6 arguments (exceeds 4 allowed). Consider refactoring.
createClassExpression: function (id, superClass, body, typeParameters, superTypeParameters, implemented) {
Function createArrowFunctionExpression
has 6 arguments (exceeds 4 allowed). Consider refactoring.
createArrowFunctionExpression: function (params, defaults, body, rest, expression, isAsync) {
Function createClassDeclaration
has 6 arguments (exceeds 4 allowed). Consider refactoring.
createClassDeclaration: function (id, superClass, body, typeParameters, superTypeParameters, implemented) {
Function checkIEEE754
has 6 arguments (exceeds 4 allowed). Consider refactoring.
function checkIEEE754 (buf, value, offset, ext, max, min) {
Function createProperty
has 6 arguments (exceeds 4 allowed). Consider refactoring.
createProperty: function (kind, key, value, method, shorthand, computed) {
Function write
has 6 arguments (exceeds 4 allowed). Consider refactoring.
exports.write = function(buffer, value, offset, isLE, mLen, nBytes) {
Function checkInt
has 6 arguments (exceeds 4 allowed). Consider refactoring.
function checkInt (buf, value, offset, ext, max, min) {
Avoid deeply nested control flow statements.
switch (ch) {
case 'n':
cooked += '\n';
break;
case 'r':
Avoid deeply nested control flow statements.
if (index >= length) {
throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
}
Avoid deeply nested control flow statements.
if (source[index] === '{') {
++index;
str += scanUnicodeCodePointEscape();
} else {
restore = index;
Avoid deeply nested control flow statements.
for (str += '\\u'; restore < index; ++restore) {
str += source[restore];
}
Avoid deeply nested control flow statements.
if (index >= length) {
throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
}
Avoid deeply nested control flow statements.
if (kind === PropertyKind.Data) {
throwErrorTolerant({}, Messages.AccessorDataProperty);
} else if (map[key] & kind) {
throwErrorTolerant({}, Messages.AccessorGetSet);
}
Avoid deeply nested control flow statements.
if (ch !== '\r' || source[index] === '\n') {
comment += source[index];
++lineNumber;
++index;
lineStart = index;
Avoid deeply nested control flow statements.
if (ch === 47) {
index += 2;
lineComment = true;
} else if (ch === 42) {
Avoid deeply nested control flow statements.
if (ch !== '0' && ch !== '1') {
break;
}
Avoid deeply nested control flow statements.
if (ch === '\r' && source[index] === '\n') {
++index;
}
Avoid deeply nested control flow statements.
if (!((operator.value === 'in' || init.kind !== 'var') && init.declarations[0].init)) {
lex();
left = init;
right = parseExpression();
init = null;
Avoid deeply nested control flow statements.
} else if (isWhiteSpace(ch.charCodeAt(0))) {
++index;
} else if (isLineTerminator(ch.charCodeAt(0))) {
++index;
if (ch === '\r' && source[index] === '\n') {
Avoid deeply nested control flow statements.
if (ch !== 13 || source.charCodeAt(index) === 10) {
++lineNumber;
++index;
lineStart = index;
if (index >= length) {
Avoid deeply nested control flow statements.
} else if (isWhiteSpace(ch)) {
++index;
} else if (isLineTerminator(ch)) {
++index;
if (ch === 13 && source.charCodeAt(index) === 10) {
Avoid deeply nested control flow statements.
if (ch === '\r') {
++index;
comment += '\r';
}
Avoid deeply nested control flow statements.
if (isOctalDigit(ch)) {
code = '01234567'.indexOf(ch);
if (code !== 0) {
Avoid deeply nested control flow statements.
if (expr.argument.type === Syntax.ObjectPattern) {
throwError({}, Messages.ObjectPatternAsSpread);
}
Avoid deeply nested control flow statements.
if (ch === 13) {
++index;
}
Avoid deeply nested control flow statements.
if (expr.type !== Syntax.MemberExpression && expr.type !== Syntax.CallExpression && expr.type !== Syntax.NewExpression) {
throwError({}, Messages.InvalidLHSInAssignment);
}
Avoid deeply nested control flow statements.
if (!checkToken) {
return scanRegExp();
}
Avoid deeply nested control flow statements.
if (tmp && tmp.type === Syntax.SpreadElement) {
if (!match(']')) {
throwError({}, Messages.ElementAfterSpreadElement);
}
} else if (!(match(']') || matchKeyword('for') || matchKeyword('if'))) {
Avoid deeply nested control flow statements.
if (strict && kind === PropertyKind.Data) {
throwErrorTolerant({}, Messages.StrictDuplicateProperty);
} else if (kind !== PropertyKind.Data) {
throwErrorTolerant({}, Messages.AccessorDataProperty);
}
Avoid deeply nested control flow statements.
if (ch === '\r' && source[index] === '\n') {
++index;
}
Avoid deeply nested control flow statements.
for (var i = 0; i < parentNode.params.length; i++) {
param = parentNode.params[i];
if (param.type === Syntax.Identifier) {
declareIdentInScope(
param.name, initScopeMetadata(parentNode), state
Avoid deeply nested control flow statements.
if (ch === '*') {
ch = source[index];
if (ch === '/') {
comment = comment.substr(0, comment.length - 1);
blockComment = false;
Avoid deeply nested control flow statements.
if (ch === '/') {
loc = {
start: {
line: lineNumber,
column: index - lineStart
Avoid deeply nested control flow statements.
if (ch === 42) {
ch = source.charCodeAt(index);
if (ch === 47) {
++index;
blockComment = false;
Avoid deeply nested control flow statements.
if (isIdentifierStart(ch) || isDecimalDigit(ch)) {
throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
}
Consider simplifying this complex logical expression.
if (checkToken &&
checkToken.type === 'Keyword' &&
(checkToken.value === 'if' ||
checkToken.value === 'while' ||
checkToken.value === 'for' ||
Function SourceNode
has 5 arguments (exceeds 4 allowed). Consider refactoring.
function SourceNode(aLine, aColumn, aSource, aChunks, aName) {
Function addComment
has 5 arguments (exceeds 4 allowed). Consider refactoring.
function addComment(type, value, start, end, loc) {
Function analyzeAndTraverse
has 5 arguments (exceeds 4 allowed). Consider refactoring.
function analyzeAndTraverse(analyzer, traverser, node, path, state) {
Function writeFloat
has 5 arguments (exceeds 4 allowed). Consider refactoring.
function writeFloat (buf, value, offset, littleEndian, noAssert) {
Function recursiveSearch
has 5 arguments (exceeds 4 allowed). Consider refactoring.
function recursiveSearch(aLow, aHigh, aNeedle, aHaystack, aCompare) {
Function _findMapping
has 5 arguments (exceeds 4 allowed). Consider refactoring.
function SourceMapConsumer_findMapping(aNeedle, aMappings, aLineName,
aColumnName, aComparator) {
Function renderXJSExpressionContainer
has 5 arguments (exceeds 4 allowed). Consider refactoring.
function renderXJSExpressionContainer(traverse, object, isLast, path, state) {
Function renderXJSLiteral
has 5 arguments (exceeds 4 allowed). Consider refactoring.
function renderXJSLiteral(object, isLast, state, start, end) {
Function writeDouble
has 5 arguments (exceeds 4 allowed). Consider refactoring.
function writeDouble (buf, value, offset, littleEndian, noAssert) {
Function read
has 5 arguments (exceeds 4 allowed). Consider refactoring.
exports.read = function(buffer, offset, isLE, mLen, nBytes) {
Function parseMethodDefinition
has 5 arguments (exceeds 4 allowed). Consider refactoring.
function parseMethodDefinition(existingPropNames, key, isStatic, generator, computed) {
Avoid too many return
statements within this function.
return {
type: Token.Punctuator,
value: ch1,
lineNumber: lineNumber,
lineStart: lineStart,
Avoid too many return
statements within this function.
return parseGroupExpression();
Avoid too many return
statements within this function.
return type;
Avoid too many return
statements within this function.
return markerApply(marker, delegate.createFunctionTypeAnnotation(
params,
returnType,
rest,
null
Avoid too many return
statements within this function.
return markerApply(marker, delegate.createIdentifier('super'));
Avoid too many return
statements within this function.
return parseXJSElement();
Avoid too many return
statements within this function.
return mappingA.generatedColumn - mappingB.generatedColumn;
Avoid too many return
statements within this function.
return scanPunctuator();
Avoid too many return
statements within this function.
return markerApply(marker, delegate.createProperty('init', key, parseAssignmentExpression(), false, false, false));
Avoid too many return
statements within this function.
return parseTemplateLiteral();
Avoid too many return
statements within this function.
return scanRegExp();
Avoid too many return
statements within this function.
return scanRegExp();
Avoid too many return
statements within this function.
return markerApply(marker, delegate.createLiteral(scanRegExp()));
Avoid too many return
statements within this function.
return markerApply(marker, delegate.createStringLiteralTypeAnnotation(
token
));
Avoid too many return
statements within this function.
return scanRegExp();
Avoid too many return
statements within this function.
return scanTemplate();
Avoid too many return
statements within this function.
return scanPunctuator();
Avoid too many return
statements within this function.
return aLow < 0
? null
: aHaystack[aLow];
Avoid too many return
statements within this function.
return false;
Avoid too many return
statements within this function.
return code - UPPER
Avoid too many return
statements within this function.
return {
type: Token.Punctuator,
value: '=>',
lineNumber: lineNumber,
lineStart: lineStart,
Avoid too many return
statements within this function.
return parsePostfixExpression();
Avoid too many return
statements within this function.
return cmp;
Avoid too many return
statements within this function.
return loaderCache[id];
Avoid too many return
statements within this function.
return markerApply(marker, delegate.createProperty('init', id, parsePropertyMethodFunction({ generator: true }), true, false, computed));
Avoid too many return
statements within this function.
return scanPunctuator();
Avoid too many return
statements within this function.
return scanStringLiteral();
Avoid too many return
statements within this function.
return scanPunctuator();
Avoid too many return
statements within this function.
return markerApply(marker, delegate.createLiteral(token));
Avoid too many return
statements within this function.
return expr;
Avoid too many return
statements within this function.
return cmp;
Avoid too many return
statements within this function.
return strcmp(mappingA.name, mappingB.name);
Avoid too many return
statements within this function.
return loaderCache[id];
Avoid too many return
statements within this function.
return loaderCache[id];
Avoid too many return
statements within this function.
return scanNumericLiteral();
Avoid too many return
statements within this function.
return scanNumericLiteral();
Avoid too many return
statements within this function.
return parseArrowFunctionExpression(params, marker);
Avoid too many return
statements within this function.
return scanIdentifier();
Avoid too many return
statements within this function.
return advanceSlash();
Avoid too many return
statements within this function.
return parseArrayInitialiser();
Avoid too many return
statements within this function.
return {
type: Token.Punctuator,
value: '<<=',
lineNumber: lineNumber,
lineStart: lineStart,
Avoid too many return
statements within this function.
return scanRegExp();
Avoid too many return
statements within this function.
return markerApply(
marker,
delegate.createProperty(
'init',
key,
Avoid too many return
statements within this function.
return markerApply(marker, delegate.createFunctionTypeAnnotation(
params,
returnType,
rest,
typeParameters
Avoid too many return
statements within this function.
return {
type: Token.Punctuator,
value: '>>>',
lineNumber: lineNumber,
lineStart: lineStart,
Avoid too many return
statements within this function.
return scanXJSIdentifier();
Avoid too many return
statements within this function.
return markerApply(
marker,
delegate.createProperty('init', id, id, false, true, false)
);
Avoid too many return
statements within this function.
return markerApply(marker, delegate.createProperty('init', key, parsePropertyMethodFunction({ generator: false }), true, false, false));
Avoid too many return
statements within this function.
return markerApply(marker, delegate.createLiteral(token));
Avoid too many return
statements within this function.
return parseObjectInitialiser();
Avoid too many return
statements within this function.
return code - LOWER + 26
Avoid too many return
statements within this function.
return {
type: Token.Punctuator,
value: ch1,
lineNumber: lineNumber,
lineStart: lineStart,
Avoid too many return
statements within this function.
return {
type: Token.Punctuator,
value: ch1 + ch2,
lineNumber: lineNumber,
lineStart: lineStart,
Avoid too many return
statements within this function.
return scanPunctuator();
Avoid too many return
statements within this function.
return parseClassExpression();
Avoid too many return
statements within this function.
return markerApply(marker, parseGenericType());
Avoid too many return
statements within this function.
return systemRequire(originalId);
Avoid too many return
statements within this function.
return {
type: Token.Punctuator,
value: '>>=',
lineNumber: lineNumber,
lineStart: lineStart,
Avoid too many return
statements within this function.
return {
type: Token.Punctuator,
value: '...',
lineNumber: lineNumber,
lineStart: lineStart,
Similar blocks of code found in 2 locations. Consider refactoring.
if (!isLineTerminator(ch.charCodeAt(0))) {
switch (ch) {
case 'n':
cooked += '\n';
break;
Similar blocks of code found in 2 locations. Consider refactoring.
if (!ch || !isLineTerminator(ch.charCodeAt(0))) {
switch (ch) {
case 'n':
str += '\n';
break;
Similar blocks of code found in 2 locations. Consider refactoring.
if (existingPropNames[propType].hasOwnProperty(key.name)) {
isValidDuplicateProp =
existingPropNames[propType][key.name].set === undefined
Similar blocks of code found in 2 locations. Consider refactoring.
if (existingPropNames[propType].hasOwnProperty(key.name)) {
isValidDuplicateProp =
existingPropNames[propType][key.name].get === undefined
Identical blocks of code found in 2 locations. Consider refactoring.
if (strict) {
if (isRestrictedWord(token.value)) {
throwErrorTolerant(token, Messages.StrictFunctionName);
}
} else {
Identical blocks of code found in 2 locations. Consider refactoring.
if (strict) {
if (isRestrictedWord(token.value)) {
throwErrorTolerant(token, Messages.StrictFunctionName);
}
} else {
Similar blocks of code found in 2 locations. Consider refactoring.
function parseIntersectionType() {
var marker = markerCreate(), type, types;
type = parsePrefixType();
types = [type];
while (match('&')) {
Similar blocks of code found in 2 locations. Consider refactoring.
function parseUnionType() {
var marker = markerCreate(), type, types;
type = parseIntersectionType();
types = [type];
while (match('|')) {
Similar blocks of code found in 2 locations. Consider refactoring.
createFunctionDeclaration: function (id, params, defaults, body, rest, generator, expression,
isAsync, returnType, typeParameters) {
var funDecl = {
type: Syntax.FunctionDeclaration,
id: id,
Similar blocks of code found in 2 locations. Consider refactoring.
createFunctionExpression: function (id, params, defaults, body, rest, generator, expression,
isAsync, returnType, typeParameters) {
var funExpr = {
type: Syntax.FunctionExpression,
id: id,
Identical blocks of code found in 2 locations. Consider refactoring.
} else if (match('[')) {
expr = markerApply(marker, delegate.createMemberExpression('[', expr, parseComputedMember()));
} else if (match('.')) {
expr = markerApply(marker, delegate.createMemberExpression('.', expr, parseNonComputedMember()));
} else {
Identical blocks of code found in 2 locations. Consider refactoring.
if (match('[')) {
expr = markerApply(marker, delegate.createMemberExpression('[', expr, parseComputedMember()));
} else if (match('.')) {
expr = markerApply(marker, delegate.createMemberExpression('.', expr, parseNonComputedMember()));
} else {
Similar blocks of code found in 2 locations. Consider refactoring.
Buffer.prototype.readUInt32LE = function (offset, noAssert) {
if (!noAssert)
checkOffset(offset, 4, this.length)
return ((this[offset]) |
Identical blocks of code found in 2 locations. Consider refactoring.
state.g.sourceMap.addMapping({
generated: { line: state.g.bufferLine, column: state.g.bufferColumn },
original: { line: state.g.sourceLine, column: state.g.sourceColumn },
source: state.g.sourceMapFilename
});
Similar blocks of code found in 2 locations. Consider refactoring.
Buffer.prototype.readInt32LE = function (offset, noAssert) {
if (!noAssert)
checkOffset(offset, 4, this.length)
return (this[offset]) |
Identical blocks of code found in 2 locations. Consider refactoring.
state.g.sourceMap.addMapping({
generated: { line: state.g.bufferLine, column: state.g.bufferColumn },
original: { line: state.g.sourceLine, column: state.g.sourceColumn },
source: state.g.sourceMapFilename
});
Identical blocks of code found in 2 locations. Consider refactoring.
if (lookahead.type === Token.Identifier) {
label = parseVariableIdentifier();
key = '$' + label.name;
if (!Object.prototype.hasOwnProperty.call(state.labelSet, key)) {
Identical blocks of code found in 2 locations. Consider refactoring.
if (lookahead.type === Token.Identifier) {
label = parseVariableIdentifier();
key = '$' + label.name;
if (!Object.prototype.hasOwnProperty.call(state.labelSet, key)) {
Similar blocks of code found in 2 locations. Consider refactoring.
Object.defineProperty(SourceMapConsumer.prototype, '_generatedMappings', {
get: function () {
if (!this.__generatedMappings) {
this.__generatedMappings = [];
this.__originalMappings = [];
Similar blocks of code found in 2 locations. Consider refactoring.
Object.defineProperty(SourceMapConsumer.prototype, '_originalMappings', {
get: function () {
if (!this.__originalMappings) {
this.__generatedMappings = [];
this.__originalMappings = [];
Similar blocks of code found in 2 locations. Consider refactoring.
if (Buffer.TYPED_ARRAY_SUPPORT) {
this[offset] = (value >>> 24)
this[offset + 1] = (value >>> 16)
this[offset + 2] = (value >>> 8)
this[offset + 3] = value
Similar blocks of code found in 2 locations. Consider refactoring.
if (Buffer.TYPED_ARRAY_SUPPORT) {
this[offset] = (value >>> 24)
this[offset + 1] = (value >>> 16)
this[offset + 2] = (value >>> 8)
this[offset + 3] = value
Identical blocks of code found in 2 locations. Consider refactoring.
if (matchKeyword('extends')) {
expectKeyword('extends');
previousYieldAllowed = state.yieldAllowed;
state.yieldAllowed = false;
superClass = parseLeftHandSideExpressionAllowCall();
Identical blocks of code found in 2 locations. Consider refactoring.
if (matchKeyword('extends')) {
expectKeyword('extends');
previousYieldAllowed = state.yieldAllowed;
state.yieldAllowed = false;
superClass = parseLeftHandSideExpressionAllowCall();
Similar blocks of code found in 2 locations. Consider refactoring.
if (ch1 === '<' && ch2 === '<' && ch3 === '=') {
index += 3;
return {
type: Token.Punctuator,
value: '<<=',
Similar blocks of code found in 2 locations. Consider refactoring.
if (ch1 === '>' && ch2 === '>' && ch3 === '=') {
index += 3;
return {
type: Token.Punctuator,
value: '>>=',
Similar blocks of code found in 2 locations. Consider refactoring.
function isIdentifierName(token) {
return token.type === Token.Identifier ||
token.type === Token.Keyword ||
token.type === Token.BooleanLiteral ||
token.type === Token.NullLiteral;
Similar blocks of code found in 2 locations. Consider refactoring.
function isFunctionNode(node) {
return (node.type == Syntax.FunctionDeclaration ||
node.type == Syntax.FunctionExpression ||
node.type == Syntax.MethodDefinition ||
node.type == Syntax.ArrowFunctionExpression);
Identical blocks of code found in 2 locations. Consider refactoring.
if (directive === 'use strict') {
strict = true;
if (firstRestricted) {
throwErrorTolerant(firstRestricted, Messages.StrictOctalLiteral);
}
Identical blocks of code found in 2 locations. Consider refactoring.
if (directive === 'use strict') {
strict = true;
if (firstRestricted) {
throwErrorTolerant(firstRestricted, Messages.StrictOctalLiteral);
}
Similar blocks of code found in 2 locations. Consider refactoring.
tmp = (decode(b64.charAt(i)) << 10) | (decode(b64.charAt(i + 1)) << 4) | (decode(b64.charAt(i + 2)) >> 2)
Similar blocks of code found in 2 locations. Consider refactoring.
tmp = (decode(b64.charAt(i)) << 18) | (decode(b64.charAt(i + 1)) << 12) | (decode(b64.charAt(i + 2)) << 6) | decode(b64.charAt(i + 3))
Similar blocks of code found in 2 locations. Consider refactoring.
function visitTypeAnnotatedObjectOrArrayPattern(traverse, node, path, state) {
utils.catchup(node.typeAnnotation.range[0], state);
utils.catchupWhiteOut(node.typeAnnotation.range[1], state);
return false;
}
Similar blocks of code found in 2 locations. Consider refactoring.
createModuleSpecifier: function (token) {
return {
type: Syntax.ModuleSpecifier,
value: token.value,
raw: source.slice(token.range[0], token.range[1])
Similar blocks of code found in 2 locations. Consider refactoring.
createStringLiteralTypeAnnotation: function (token) {
return {
type: Syntax.StringLiteralTypeAnnotation,
value: token.value,
raw: source.slice(token.range[0], token.range[1])
Similar blocks of code found in 2 locations. Consider refactoring.
function visitTypeAnnotatedIdentifier(traverse, node, path, state) {
utils.catchup(node.typeAnnotation.range[0], state);
utils.catchupWhiteOut(node.typeAnnotation.range[1], state);
return false;
}
Similar blocks of code found in 2 locations. Consider refactoring.
createClassExpression: function (id, superClass, body, typeParameters, superTypeParameters, implemented) {
return {
type: Syntax.ClassExpression,
id: id,
superClass: superClass,
Similar blocks of code found in 2 locations. Consider refactoring.
createClassDeclaration: function (id, superClass, body, typeParameters, superTypeParameters, implemented) {
return {
type: Syntax.ClassDeclaration,
id: id,
superClass: superClass,
Similar blocks of code found in 2 locations. Consider refactoring.
while (index < length) {
if (match('}')) {
break;
}
statement = parseSourceElement();
Similar blocks of code found in 2 locations. Consider refactoring.
while (index < length) {
if (match('}')) {
break;
}
sourceElement = parseSourceElement();
Identical blocks of code found in 2 locations. Consider refactoring.
if (length > 0) {
if (typeof source[0] === 'undefined') {
Identical blocks of code found in 2 locations. Consider refactoring.
if (length > 0) {
if (typeof source[0] === 'undefined') {
Similar blocks of code found in 4 locations. Consider refactoring.
Buffer.prototype.readFloatBE = function (offset, noAssert) {
if (!noAssert)
checkOffset(offset, 4, this.length)
return ieee754.read(this, offset, false, 23, 4)
}
Similar blocks of code found in 4 locations. Consider refactoring.
Buffer.prototype.readFloatLE = function (offset, noAssert) {
if (!noAssert)
checkOffset(offset, 4, this.length)
return ieee754.read(this, offset, true, 23, 4)
}
Similar blocks of code found in 4 locations. Consider refactoring.
Buffer.prototype.readDoubleBE = function (offset, noAssert) {
if (!noAssert)
checkOffset(offset, 8, this.length)
return ieee754.read(this, offset, false, 52, 8)
}
Similar blocks of code found in 4 locations. Consider refactoring.
Buffer.prototype.readDoubleLE = function (offset, noAssert) {
if (!noAssert)
checkOffset(offset, 8, this.length)
return ieee754.read(this, offset, true, 52, 8)
}
Similar blocks of code found in 2 locations. Consider refactoring.
function writeFloat (buf, value, offset, littleEndian, noAssert) {
if (!noAssert)
checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
ieee754.write(buf, value, offset, littleEndian, 23, 4)
return offset + 4
Similar blocks of code found in 2 locations. Consider refactoring.
function writeDouble (buf, value, offset, littleEndian, noAssert) {
if (!noAssert)
checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
ieee754.write(buf, value, offset, littleEndian, 52, 8)
return offset + 8
Similar blocks of code found in 2 locations. Consider refactoring.
for (var ii = 0; ii < numQuasis; ii++) {
utils.append(getCookedValue(template.quasis[ii]), state);
if (ii !== numQuasis - 1) {
utils.append(', ', state);
}
Similar blocks of code found in 2 locations. Consider refactoring.
for (ii = 0; ii < numQuasis; ii++) {
utils.append(getRawValue(template.quasis[ii]), state);
if (ii !== numQuasis - 1) {
utils.append(', ', state);
}
Similar blocks of code found in 3 locations. Consider refactoring.
function visitFunctionReturnAnnotation(traverse, node, path, state) {
utils.catchup(node.range[0], state);
utils.catchupWhiteOut(node.range[1], state);
return false;
}
Similar blocks of code found in 3 locations. Consider refactoring.
function visitClassProperty(traverse, node, path, state) {
utils.catchup(node.range[0], state);
utils.catchupWhiteOut(node.range[1], state);
return false;
}
Similar blocks of code found in 3 locations. Consider refactoring.
function visitFunctionParametricAnnotation(traverse, node, path, state) {
utils.catchup(node.range[0], state);
utils.catchupWhiteOut(node.range[1], state);
return false;
}
Similar blocks of code found in 2 locations. Consider refactoring.
} else if (Object.prototype.hasOwnProperty.call(options.paramSet, key)) {
options.firstRestricted = param;
options.message = Messages.StrictParamDupe;
}
Similar blocks of code found in 2 locations. Consider refactoring.
} else if (match('[')) {
id = parseArrayInitialiser();
reinterpretAsAssignmentBindingPattern(id);
if (match(':')) {
id.typeAnnotation = parseTypeAnnotation();
Similar blocks of code found in 2 locations. Consider refactoring.
if (Object.prototype.hasOwnProperty.call(options.paramSet, key)) {
options.stricted = param;
options.message = Messages.StrictParamDupe;
}
Similar blocks of code found in 2 locations. Consider refactoring.
aSourceMapConsumer.sources.forEach(function (sourceFile) {
var content = aSourceMapConsumer.sourceContentFor(sourceFile);
if (content) {
generator.setSourceContent(sourceFile, content);
}
Similar blocks of code found in 2 locations. Consider refactoring.
aSourceMapConsumer.sources.forEach(function (sourceFile) {
var content = aSourceMapConsumer.sourceContentFor(sourceFile);
if (content) {
node.setSourceContent(sourceFile, content);
}
Similar blocks of code found in 2 locations. Consider refactoring.
if (match('{')) {
id = parseObjectInitialiser();
reinterpretAsAssignmentBindingPattern(id);
if (match(':')) {
id.typeAnnotation = parseTypeAnnotation();
Similar blocks of code found in 2 locations. Consider refactoring.
if (sourceLines.length > 1) {
state.g.sourceLine += sourceLines.length - 1;
state.g.sourceColumn = 0;
}
Similar blocks of code found in 2 locations. Consider refactoring.
if (transformedLines.length > 1) {
state.g.bufferLine += transformedLines.length - 1;
state.g.bufferColumn = 0;
}
Similar blocks of code found in 2 locations. Consider refactoring.
return op === '=' ||
op === '*=' ||
op === '/=' ||
op === '%=' ||
op === '+=' ||
Similar blocks of code found in 2 locations. Consider refactoring.
return (id === 'while') || (id === 'break') || (id === 'catch') ||
(id === 'throw') || (id === 'const') ||
(id === 'class') || (id === 'super');
Similar blocks of code found in 2 locations. Consider refactoring.
if (Buffer.TYPED_ARRAY_SUPPORT) {
this[offset] = value
this[offset + 1] = (value >>> 8)
} else objectWriteUInt16(this, value, offset, true)
Similar blocks of code found in 2 locations. Consider refactoring.
if (Buffer.TYPED_ARRAY_SUPPORT) {
this[offset] = value
this[offset + 1] = (value >>> 8)
} else objectWriteUInt16(this, value, offset, true)
Similar blocks of code found in 2 locations. Consider refactoring.
if (end < 0) {
end += len
if (end < 0)
end = 0
} else if (end > len) {
Similar blocks of code found in 2 locations. Consider refactoring.
if (Buffer.TYPED_ARRAY_SUPPORT) {
this[offset] = (value >>> 8)
this[offset + 1] = value
} else objectWriteUInt16(this, value, offset, false)
Similar blocks of code found in 2 locations. Consider refactoring.
if (start < 0) {
start += len;
if (start < 0)
start = 0
} else if (start > len) {
Similar blocks of code found in 2 locations. Consider refactoring.
if (Buffer.TYPED_ARRAY_SUPPORT) {
this[offset] = (value >>> 8)
this[offset + 1] = value
} else objectWriteUInt16(this, value, offset, false)
Similar blocks of code found in 2 locations. Consider refactoring.
case 6:
return (id === 'return') || (id === 'typeof') || (id === 'delete') ||
(id === 'switch') || (id === 'export') || (id === 'import');
Similar blocks of code found in 2 locations. Consider refactoring.
visitReactDisplayName.test = function(object, path, state) {
return (
object.type === Syntax.AssignmentExpression ||
object.type === Syntax.Property ||
object.type === Syntax.VariableDeclarator
Similar blocks of code found in 2 locations. Consider refactoring.
case 4:
return (id === 'this') || (id === 'else') || (id === 'case') ||
(id === 'void') || (id === 'with') || (id === 'enum');
Similar blocks of code found in 2 locations. Consider refactoring.
function _isFunctionNode(node) {
return node.type === Syntax.FunctionDeclaration
|| node.type === Syntax.FunctionExpression
|| node.type === Syntax.ArrowFunctionExpression;
}
Similar blocks of code found in 3 locations. Consider refactoring.
if (strict && expr.type === Syntax.Identifier && isRestrictedWord(expr.name)) {
throwErrorTolerant({}, Messages.StrictLHSPostfix);
}
Similar blocks of code found in 3 locations. Consider refactoring.
if (strict && expr.type === Syntax.Identifier && isRestrictedWord(expr.name)) {
throwErrorTolerant({}, Messages.StrictLHSPrefix);
}
Similar blocks of code found in 3 locations. Consider refactoring.
if (strict && param.type === Syntax.Identifier && isRestrictedWord(param.name)) {
throwErrorTolerant({}, Messages.StrictCatchVariable);
}
Similar blocks of code found in 2 locations. Consider refactoring.
return (ch === 36) || (ch === 95) ||
(ch >= 65 && ch <= 90) ||
(ch >= 97 && ch <= 122) ||
(ch === 92) ||
Similar blocks of code found in 2 locations. Consider refactoring.
function parseAwaitExpression() {
var expr, marker = markerCreate();
expectContextualKeyword('await');
expr = parseAssignmentExpression();
return markerApply(marker, delegate.createAwaitExpression(expr));
Similar blocks of code found in 2 locations. Consider refactoring.
return (ch === 36) || (ch === 95) ||
(ch >= 65 && ch <= 90) ||
(ch >= 97 && ch <= 122) ||
(ch >= 48 && ch <= 57) ||
Similar blocks of code found in 2 locations. Consider refactoring.
function parseTypeofType() {
var argument, marker = markerCreate();
expectKeyword('typeof');
argument = parsePrimaryType();
return markerApply(marker, delegate.createTypeofTypeAnnotation(
Similar blocks of code found in 2 locations. Consider refactoring.
if (!ch || ch === '\\' || !isIdentifierPart(ch.charCodeAt(0))) {
throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
}
Similar blocks of code found in 2 locations. Consider refactoring.
if (entry.regex) {
token.regex = {
pattern: entry.regex.pattern,
flags: entry.regex.flags
};
Similar blocks of code found in 2 locations. Consider refactoring.
if (!ch || ch === '\\' || !isIdentifierStart(ch.charCodeAt(0))) {
throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
}
Similar blocks of code found in 2 locations. Consider refactoring.
if (token.regex) {
entry.regex = {
pattern: token.regex.pattern,
flags: token.regex.flags
};
Similar blocks of code found in 3 locations. Consider refactoring.
createTryStatement: function (block, guardedHandlers, handlers, finalizer) {
return {
type: Syntax.TryStatement,
block: block,
guardedHandlers: guardedHandlers,
Similar blocks of code found in 2 locations. Consider refactoring.
path = normalizeArray(filter(path.split('/'), function(p) {
return !!p;
}), !isAbsolute).join('/');
Similar blocks of code found in 2 locations. Consider refactoring.
exports.decode = function base64_decode(aChar) {
if (aChar in charToIntMap) {
return charToIntMap[aChar];
}
throw new TypeError("Not a valid base 64 digit: " + aChar);
Similar blocks of code found in 4 locations. Consider refactoring.
createClassProperty: function (key, typeAnnotation, computed, isStatic) {
return {
type: Syntax.ClassProperty,
key: key,
typeAnnotation: typeAnnotation,
Similar blocks of code found in 4 locations. Consider refactoring.
createObjectTypeProperty: function (key, value, optional, isStatic) {
return {
type: Syntax.ObjectTypeProperty,
key: key,
value: value,
Similar blocks of code found in 2 locations. Consider refactoring.
while (!match('>')) {
paramTypes.push(parseVariableIdentifier());
if (!match('>')) {
expect(',');
}
Similar blocks of code found in 2 locations. Consider refactoring.
while (!match('>')) {
paramTypes.push(parseType());
if (!match('>')) {
expect(',');
}
Similar blocks of code found in 4 locations. Consider refactoring.
createObjectTypeIndexer: function (id, key, value, isStatic) {
return {
type: Syntax.ObjectTypeIndexer,
id: id,
key: key,
Similar blocks of code found in 4 locations. Consider refactoring.
createInterface: function (id, typeParameters, body, extended) {
return {
type: Syntax.InterfaceDeclaration,
id: id,
typeParameters: typeParameters,
Similar blocks of code found in 2 locations. Consider refactoring.
resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) {
return !!p;
}), !resolvedAbsolute).join('/');
Similar blocks of code found in 2 locations. Consider refactoring.
exports.encode = function base64_encode(aNumber) {
if (aNumber in intToCharMap) {
return intToCharMap[aNumber];
}
throw new TypeError("Must be between 0 and 63: " + aNumber);
Similar blocks of code found in 3 locations. Consider refactoring.
createForStatement: function (init, test, update, body) {
return {
type: Syntax.ForStatement,
init: init,
test: test,
Similar blocks of code found in 3 locations. Consider refactoring.
createFunctionTypeAnnotation: function (params, returnType, rest, typeParameters) {
return {
type: Syntax.FunctionTypeAnnotation,
params: params,
returnType: returnType,
Similar blocks of code found in 2 locations. Consider refactoring.
visitFunctionBodyWithRestParam.test = function(node, path, state) {
return node.type === Syntax.BlockStatement
&& _nodeIsFunctionWithRestParam(path[0]);
};
Similar blocks of code found in 2 locations. Consider refactoring.
} else if (extra.tokens[extra.openCurlyToken - 4] &&
extra.tokens[extra.openCurlyToken - 4].type === 'Keyword') {
checkToken = extra.tokens[extra.openCurlyToken - 5];
if (!checkToken) {
Similar blocks of code found in 2 locations. Consider refactoring.
if (expr.type !== Syntax.MemberExpression && expr.type !== Syntax.CallExpression && expr.type !== Syntax.NewExpression) {
throwError({}, Messages.InvalidLHSInAssignment);
}
Similar blocks of code found in 2 locations. Consider refactoring.
if (extra.tokens[extra.openCurlyToken - 3] &&
extra.tokens[extra.openCurlyToken - 3].type === 'Keyword') {
checkToken = extra.tokens[extra.openCurlyToken - 4];
if (!checkToken) {
Similar blocks of code found in 2 locations. Consider refactoring.
if (substitution.type === Syntax.Identifier ||
substitution.type === Syntax.MemberExpression ||
substitution.type === Syntax.CallExpression) {
utils.catchup(substitution.range[1], state);
} else {
Similar blocks of code found in 2 locations. Consider refactoring.
visitFunctionBodyForStructuredParameter.test = function(node, path, state) {
return node.type === Syntax.BlockStatement && isFunctionNode(path[0]);
};
Identical blocks of code found in 2 locations. Consider refactoring.
if (node.id) {
metaData = initScopeMetadata(getBoundaryNode(path), path.slice(), node);
declareIdentInScope(node.id.name, metaData, state);
}
Identical blocks of code found in 2 locations. Consider refactoring.
if ('<>=!+-*%&|^/'.indexOf(ch1) >= 0) {
++index;
return {
type: Token.Punctuator,
value: ch1,
Identical blocks of code found in 2 locations. Consider refactoring.
if (!matchContextualKeyword('from')) {
throwError({}, lookahead.value ?
Messages.UnexpectedToken : Messages.MissingFromClause, lookahead.value);
}
Identical blocks of code found in 2 locations. Consider refactoring.
if (path[0].kind === 'var') {
metaData = initScopeMetadata(getBoundaryNode(path), path.slice(), node);
declareIdentInScope(node.id.name, metaData, state);
}
Identical blocks of code found in 2 locations. Consider refactoring.
if (ch1 === '.') {
++index;
return {
type: Token.Punctuator,
value: ch1,
Identical blocks of code found in 2 locations. Consider refactoring.
if (!matchContextualKeyword('from')) {
throwError({}, lookahead.value ?
Messages.UnexpectedToken : Messages.MissingFromClause, lookahead.value);
}
There are no issues that match your filters.