Comparing version 2.7.5 to 2.7.6
@@ -7,6 +7,2 @@ 'use strict'; | ||
var _lodash = require('lodash'); | ||
var _lodash2 = _interopRequireDefault(_lodash); | ||
var _espree = require('espree'); | ||
@@ -28,8 +24,8 @@ | ||
parse: function parse(js, opts) { | ||
return _espree2.default.parse(js, _lodash2.default.assign(opts, ESPREE_OPTS)); | ||
return _espree2.default.parse(js, Object.assign({}, opts, ESPREE_OPTS)); | ||
}, | ||
tokenize: function tokenize(js, opts) { | ||
return _espree2.default.tokenize(js, _lodash2.default.assign(opts, ESPREE_OPTS)); | ||
return _espree2.default.tokenize(js, Object.assign({}, opts, ESPREE_OPTS)); | ||
} | ||
}; | ||
module.exports = exports['default']; |
@@ -9,6 +9,4 @@ 'use strict'; | ||
var _lodash = require('lodash'); | ||
var _fp = require('lodash/fp'); | ||
var _lodash2 = _interopRequireDefault(_lodash); | ||
var _traverser = require('../traverser'); | ||
@@ -89,12 +87,13 @@ | ||
value: function hoistFunctionParams(params) { | ||
var _this = this; | ||
(0, _lodash2.default)(params).map(destructuring.extractVariables).flatten().forEach(function (p) { | ||
_this.functionScope.register(p.name, new _Variable2.default(p)); | ||
}); | ||
return (0, _fp.flow)((0, _fp.map)(destructuring.extractVariables), _fp.flatten, (0, _fp.forEach)(this.registerParam.bind(this)))(params); | ||
} | ||
}, { | ||
key: 'registerParam', | ||
value: function registerParam(p) { | ||
this.functionScope.register(p.name, new _Variable2.default(p)); | ||
} | ||
}, { | ||
key: 'hoistVariables', | ||
value: function hoistVariables(ast) { | ||
var _this2 = this; | ||
var _this = this; | ||
@@ -105,7 +104,7 @@ _traverser2.default.traverse(ast, { | ||
if (node.type === 'VariableDeclaration') { | ||
_this2.hoistVariableDeclaration(node, parent); | ||
_this.hoistVariableDeclaration(node, parent); | ||
} else if (functionType.isFunctionDeclaration(node)) { | ||
// Register variable for the function if it has a name | ||
if (node.id) { | ||
_this2.functionScope.register(node.id.name, new _Variable2.default(node)); | ||
_this.functionScope.register(node.id.name, new _Variable2.default(node)); | ||
} | ||
@@ -124,3 +123,3 @@ // Skip anything inside the nested function | ||
value: function hoistVariableDeclaration(node, parent) { | ||
var _this3 = this; | ||
var _this2 = this; | ||
@@ -136,3 +135,3 @@ var group = new _VariableGroup2.default(node, parent); | ||
destructuring.extractVariableNames(declaratorNode.id).forEach(function (name) { | ||
_this3.functionScope.register(name, variable); | ||
_this2.functionScope.register(name, variable); | ||
}); | ||
@@ -139,0 +138,0 @@ }); |
@@ -9,8 +9,4 @@ 'use strict'; | ||
var _lodash = require('lodash'); | ||
var _fp = require('lodash/fp'); | ||
var _lodash2 = _interopRequireDefault(_lodash); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -58,3 +54,3 @@ | ||
value: function getVariables() { | ||
return _lodash2.default.values(this.vars); | ||
return (0, _fp.values)(this.vars); | ||
} | ||
@@ -61,0 +57,0 @@ }]); |
@@ -9,8 +9,4 @@ 'use strict'; | ||
var _lodash = require('lodash'); | ||
var _fp = require('lodash/fp'); | ||
var _lodash2 = _interopRequireDefault(_lodash); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -106,3 +102,3 @@ | ||
var minVal = _lodash2.default.min(this.variables.map(function (v) { | ||
var minVal = (0, _fp.min)(this.variables.map(function (v) { | ||
return kindToVal[v.getKind()]; | ||
@@ -109,0 +105,0 @@ })); |
@@ -9,8 +9,4 @@ 'use strict'; | ||
var _lodash = require('lodash'); | ||
var _fp = require('lodash/fp'); | ||
var _lodash2 = _interopRequireDefault(_lodash); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -63,3 +59,3 @@ | ||
// therefore marked as hoisted. | ||
if (!_lodash2.default.includes(alreadySeen, blockVar)) { | ||
if (!(0, _fp.includes)(blockVar, alreadySeen)) { | ||
alreadySeen.push(blockVar); | ||
@@ -66,0 +62,0 @@ |
@@ -11,5 +11,5 @@ 'use strict'; | ||
if (isES5Function(node) && node.params.length === 0) { | ||
var argumentsVar = _lodash2.default.find(scope.variables, function (v) { | ||
var argumentsVar = (0, _fp.find)(function (v) { | ||
return v.name === 'arguments'; | ||
}); | ||
}, scope.variables); | ||
// Look through all the places where arguments is used: | ||
@@ -32,6 +32,4 @@ // Make sure none of these has access to some already existing `args` variable | ||
var _lodash = require('lodash'); | ||
var _fp = require('lodash/fp'); | ||
var _lodash2 = _interopRequireDefault(_lodash); | ||
var _traverser = require('../traverser'); | ||
@@ -38,0 +36,0 @@ |
@@ -23,3 +23,3 @@ 'use strict'; | ||
if (memberExpr && _lodash2.default.isEqual(omitLoc(memberExpr.object), omitLoc(thisParam))) { | ||
if (memberExpr && (0, _fp.isEqual)(omitLoc(memberExpr.object), omitLoc(thisParam))) { | ||
return createCallWithSpread(memberExpr, arrayParam); | ||
@@ -31,6 +31,4 @@ } | ||
var _lodash = require('lodash'); | ||
var _fp = require('lodash/fp'); | ||
var _lodash2 = _interopRequireDefault(_lodash); | ||
var _traverser = require('../traverser'); | ||
@@ -59,6 +57,6 @@ | ||
function omitLoc(obj) { | ||
if (_lodash2.default.isArray(obj)) { | ||
if ((0, _fp.isArray)(obj)) { | ||
return obj.map(omitLoc); | ||
} else if (_lodash2.default.isObjectLike(obj)) { | ||
return (0, _lodash2.default)(obj).omit('loc', 'start', 'end').mapValues(omitLoc).value(); | ||
} else if ((0, _fp.isObjectLike)(obj)) { | ||
return (0, _fp.flow)((0, _fp.omit)(['loc', 'start', 'end']), (0, _fp.mapValues)(omitLoc))(obj); | ||
} else { | ||
@@ -65,0 +63,0 @@ return obj; |
@@ -28,6 +28,4 @@ 'use strict'; | ||
var _lodash = require('lodash'); | ||
var _fp = require('lodash/fp'); | ||
var _lodash2 = _interopRequireDefault(_lodash); | ||
var _traverser = require('../traverser'); | ||
@@ -90,3 +88,3 @@ | ||
function hasInFunctionBody(ast, pattern) { | ||
return _traverser2.default.find(ast, _lodash2.default.matches(pattern), { | ||
return _traverser2.default.find(ast, (0, _fp.matches)(pattern), { | ||
skipTypes: ['FunctionExpression', 'FunctionDeclaration'] | ||
@@ -93,0 +91,0 @@ }); |
@@ -8,8 +8,4 @@ 'use strict'; | ||
var _lodash = require('lodash'); | ||
var _fp = require('lodash/fp'); | ||
var _lodash2 = _interopRequireDefault(_lodash); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
/** | ||
@@ -21,6 +17,6 @@ * Extracts comments from an array of nodes. | ||
function extractComments(nodes) { | ||
return _lodash2.default.flatten(nodes.map(function (n) { | ||
return (0, _fp.flatMap)(function (n) { | ||
return n.comments || []; | ||
})); | ||
}, nodes); | ||
} | ||
module.exports = exports['default']; |
@@ -84,3 +84,3 @@ 'use strict'; | ||
if (node.type === 'Program') { | ||
(0, _lodash2.default)(potentialClasses).filter(function (cls) { | ||
(0, _fp.values)(potentialClasses).filter(function (cls) { | ||
return cls.isTransformable() ? true : logWarning(cls); | ||
@@ -101,6 +101,4 @@ }).forEach(function (cls) { | ||
var _lodash = require('lodash'); | ||
var _fp = require('lodash/fp'); | ||
var _lodash2 = _interopRequireDefault(_lodash); | ||
var _traverser = require('../../traverser'); | ||
@@ -107,0 +105,0 @@ |
@@ -9,10 +9,6 @@ 'use strict'; | ||
var _lodash = require('lodash'); | ||
var _fp = require('lodash/fp'); | ||
var _lodash2 = _interopRequireDefault(_lodash); | ||
var _matchesAst = require('../../../utils/matchesAst'); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -44,5 +40,5 @@ | ||
var declaration = _lodash2.default.find(node.declarations, function (dec) { | ||
var declaration = (0, _fp.find)(function (dec) { | ||
return _this.isRequireUtil(dec); | ||
}); | ||
}, node.declarations); | ||
if (declaration) { | ||
@@ -49,0 +45,0 @@ return { |
@@ -9,10 +9,6 @@ 'use strict'; | ||
var _lodash = require('lodash'); | ||
var _fp = require('lodash/fp'); | ||
var _lodash2 = _interopRequireDefault(_lodash); | ||
var _matchesAst = require('../../../utils/matchesAst'); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -44,5 +40,5 @@ | ||
var declaration = _lodash2.default.find(node.declarations, function (dec) { | ||
var declaration = (0, _fp.find)(function (dec) { | ||
return _this.isRequireUtilInherits(dec); | ||
}); | ||
}, node.declarations); | ||
if (declaration) { | ||
@@ -49,0 +45,0 @@ return { |
@@ -9,6 +9,4 @@ 'use strict'; | ||
var _lodash = require('lodash'); | ||
var _fp = require('lodash/fp'); | ||
var _lodash2 = _interopRequireDefault(_lodash); | ||
var _extractComments = require('./extractComments'); | ||
@@ -200,3 +198,3 @@ | ||
return _lodash2.default.compact([this.createConstructor()].concat(_toConsumableArray(this.methods.map(function (method) { | ||
return (0, _fp.compact)([this.createConstructor()].concat(_toConsumableArray(this.methods.map(function (method) { | ||
method.setSuperClass(_this.superClass); | ||
@@ -203,0 +201,0 @@ return method.toMethodDefinition(); |
@@ -48,6 +48,4 @@ 'use strict'; | ||
var _lodash = require('lodash'); | ||
var _fp = require('lodash/fp'); | ||
var _lodash2 = _interopRequireDefault(_lodash); | ||
var _recast = require('recast'); | ||
@@ -167,6 +165,6 @@ | ||
function uniqPropNames(exs) { | ||
return (0, _lodash2.default)(exs).map(function (_ref3) { | ||
return (0, _fp.uniq)(exs.map(function (_ref3) { | ||
var property = _ref3.property; | ||
return property.name; | ||
}).uniq().value(); | ||
})); | ||
} | ||
@@ -173,0 +171,0 @@ |
@@ -29,6 +29,4 @@ 'use strict'; | ||
var _lodash = require('lodash'); | ||
var _fp = require('lodash/fp'); | ||
var _lodash2 = _interopRequireDefault(_lodash); | ||
var _traverser = require('../../traverser'); | ||
@@ -97,3 +95,3 @@ | ||
return Object.assign({}, body, { | ||
body: _lodash2.default.tail(body.body) | ||
body: (0, _fp.tail)(body.body) | ||
}); | ||
@@ -100,0 +98,0 @@ } |
@@ -33,6 +33,4 @@ 'use strict'; | ||
var _lodash = require('lodash'); | ||
var _fp = require('lodash/fp'); | ||
var _lodash2 = _interopRequireDefault(_lodash); | ||
var _traverser = require('../traverser'); | ||
@@ -97,5 +95,5 @@ | ||
return Object.assign({}, body, { | ||
body: _lodash2.default.tail(body.body) | ||
body: (0, _fp.tail)(body.body) | ||
}); | ||
} | ||
module.exports = exports['default']; |
@@ -56,6 +56,4 @@ 'use strict'; | ||
var _lodash = require('lodash'); | ||
var _fp = require('lodash/fp'); | ||
var _lodash2 = _interopRequireDefault(_lodash); | ||
var _traverser = require('../traverser'); | ||
@@ -218,5 +216,5 @@ | ||
function getFunctionVariableGroups() { | ||
return (0, _lodash2.default)(getScope().getVariables()).map(function (v) { | ||
return (0, _fp.flow)((0, _fp.map)(function (v) { | ||
return v.getGroup(); | ||
}).uniq().compact().value(); | ||
}), _fp.uniq, _fp.compact)(getScope().getVariables()); | ||
} | ||
@@ -223,0 +221,0 @@ |
@@ -16,3 +16,3 @@ 'use strict'; | ||
// Ensure correct order of comments by sorting them by their position in source | ||
literal.comments = _lodash2.default.sortBy(plusExpr.comments, 'start'); | ||
literal.comments = (0, _fp.sortBy)('start', plusExpr.comments); | ||
return literal; | ||
@@ -41,6 +41,4 @@ } | ||
var _lodash = require('lodash'); | ||
var _fp = require('lodash/fp'); | ||
var _lodash2 = _interopRequireDefault(_lodash); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -59,4 +57,4 @@ | ||
return { | ||
operands: _lodash2.default.flatten([left.operands, right.operands]), | ||
comments: _lodash2.default.flatten([node.comments || [], left.comments, right.comments]), | ||
operands: (0, _fp.flatten)([left.operands, right.operands]), | ||
comments: (0, _fp.flatten)([node.comments || [], left.comments, right.comments]), | ||
isString: true | ||
@@ -63,0 +61,0 @@ }; |
@@ -7,6 +7,4 @@ 'use strict'; | ||
var _lodash = require('lodash'); | ||
var _fp = require('lodash/fp'); | ||
var _lodash2 = _interopRequireDefault(_lodash); | ||
var _estraverse = require('estraverse'); | ||
@@ -39,3 +37,3 @@ | ||
var extensions = { | ||
keys: _lodash2.default.assign({}, jsxExtensionKeys, experimentalExtensionKeys) | ||
keys: Object.assign({}, jsxExtensionKeys, experimentalExtensionKeys) | ||
}; | ||
@@ -58,3 +56,3 @@ | ||
traverse: function traverse(tree, cfg) { | ||
return _estraverse2.default.traverse(tree, _lodash2.default.assign(cfg, extensions)); | ||
return _estraverse2.default.traverse(tree, Object.assign(cfg, extensions)); | ||
}, | ||
@@ -70,3 +68,3 @@ | ||
replace: function replace(tree, cfg) { | ||
return _estraverse2.default.replace(tree, _lodash2.default.assign(cfg, extensions)); | ||
return _estraverse2.default.replace(tree, Object.assign(cfg, extensions)); | ||
}, | ||
@@ -102,3 +100,3 @@ | ||
enter: function enter(node, parent) { | ||
if (_lodash2.default.includes(skipTypes, node.type)) { | ||
if ((0, _fp.includes)(node.type, skipTypes)) { | ||
return _estraverse2.default.VisitorOption.Skip; | ||
@@ -116,3 +114,3 @@ } | ||
createFindPredicate: function createFindPredicate(query) { | ||
if (_lodash2.default.isString(query)) { | ||
if ((0, _fp.isString)(query)) { | ||
return function (node) { | ||
@@ -119,0 +117,0 @@ return node.type === query; |
@@ -9,8 +9,4 @@ 'use strict'; | ||
var _lodash = require('lodash'); | ||
var _fp = require('lodash/fp'); | ||
var _lodash2 = _interopRequireDefault(_lodash); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
/** | ||
@@ -32,6 +28,6 @@ * Extracts all variables from from destructuring | ||
if (node.type === 'ArrayPattern') { | ||
return (0, _lodash2.default)(node.elements).map(extractVariables).flatten().value(); | ||
return (0, _fp.flatMap)(extractVariables, node.elements); | ||
} | ||
if (node.type === 'ObjectPattern') { | ||
return (0, _lodash2.default)(node.properties).map(extractVariables).flatten().value(); | ||
return (0, _fp.flatMap)(extractVariables, node.properties); | ||
} | ||
@@ -38,0 +34,0 @@ if (node.type === 'Property') { |
@@ -8,8 +8,4 @@ 'use strict'; | ||
var _lodash = require('lodash'); | ||
var _fp = require('lodash/fp'); | ||
var _lodash2 = _interopRequireDefault(_lodash); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var metaDataFields = { | ||
@@ -31,6 +27,6 @@ comments: true, | ||
function isEqualAst(a, b) { | ||
return _lodash2.default.isEqualWith(a, b, function (aValue, bValue, key) { | ||
return (0, _fp.isEqualWith)(function (aValue, bValue, key) { | ||
return metaDataFields[key]; | ||
}); | ||
}, a, b); | ||
} | ||
module.exports = exports['default']; |
@@ -14,8 +14,4 @@ 'use strict'; | ||
var _lodash = require('lodash'); | ||
var _fp = require('lodash/fp'); | ||
var _lodash2 = _interopRequireDefault(_lodash); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
@@ -60,11 +56,11 @@ | ||
var matches = _lodash2.default.isMatchWith(ast, pattern, function (value, matcher) { | ||
var matches = (0, _fp.isMatchWith)(function (value, matcher) { | ||
if (typeof matcher === 'function') { | ||
var result = matcher(value); | ||
if ((typeof result === 'undefined' ? 'undefined' : _typeof(result)) === 'object') { | ||
_lodash2.default.assign(extractedFields, result); | ||
Object.assign(extractedFields, result); | ||
} | ||
return result; | ||
} | ||
}); | ||
}, pattern, ast); | ||
@@ -96,3 +92,3 @@ if (matches) { | ||
if ((typeof result === 'undefined' ? 'undefined' : _typeof(result)) === 'object') { | ||
return _lodash2.default.assign(extractedFields, result); | ||
return Object.assign(extractedFields, result); | ||
} | ||
@@ -99,0 +95,0 @@ if (!result) { |
{ | ||
"name": "lebab", | ||
"version": "2.7.5", | ||
"version": "2.7.6", | ||
"description": "Turn your ES5 code into readable ES6/ES7", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -17,3 +17,3 @@ [![Build Status](https://img.shields.io/travis/lebab/lebab.svg)](http://travis-ci.org/lebab/lebab) | ||
## Usage | ||
## Install | ||
@@ -26,2 +26,9 @@ Install it using npm: | ||
Full build: | ||
- [latest Browerified version of Lebab](https://wzrd.in/standalone/lebab@latest) | ||
- [the same, using cdn.rawgit](https://umdfied.herokuapp.com/umdfied/lebab/latest) | ||
## Usage | ||
Convert your old-fashioned code using the `lebab` cli tool, | ||
@@ -28,0 +35,0 @@ enabling a specific transformation: |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
224
218487
5492