UNPKG

electron-angular-boilerplate

Version:

A basic electron app using AngularJS and Skeleton CSS with ES6 support

195 lines (152 loc) 5.12 kB
/* */ "format cjs"; "use strict"; var _toolsProtectJs2 = require("./../../tools/protect.js"); var _toolsProtectJs3 = _interopRequireDefault(_toolsProtectJs2); exports.__esModule = true; exports.NullableTypeAnnotation = NullableTypeAnnotation; exports.UpdateExpression = UpdateExpression; exports.ObjectExpression = ObjectExpression; exports.Binary = Binary; exports.BinaryExpression = BinaryExpression; exports.SequenceExpression = SequenceExpression; exports.YieldExpression = YieldExpression; exports.ClassExpression = ClassExpression; exports.UnaryLike = UnaryLike; exports.FunctionExpression = FunctionExpression; exports.ConditionalExpression = ConditionalExpression; exports.AssignmentExpression = AssignmentExpression; function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } var _lodashCollectionEach = require("lodash/collection/each"); var _lodashCollectionEach2 = _interopRequireDefault(_lodashCollectionEach); var _types = require("../../types"); var t = _interopRequireWildcard(_types); _toolsProtectJs3["default"](module); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } var PRECEDENCE = {}; _lodashCollectionEach2["default"]([["||"], ["&&"], ["|"], ["^"], ["&"], ["==", "===", "!=", "!=="], ["<", ">", "<=", ">=", "in", "instanceof"], [">>", "<<", ">>>"], ["+", "-"], ["*", "/", "%"], ["**"]], function (tier, i) { _lodashCollectionEach2["default"](tier, function (op) { PRECEDENCE[op] = i; }); }); function NullableTypeAnnotation(node, parent) { return t.isArrayTypeAnnotation(parent); } exports.FunctionTypeAnnotation = NullableTypeAnnotation; function UpdateExpression(node, parent) { if (t.isMemberExpression(parent) && parent.object === node) { // (foo++).test() return true; } } function ObjectExpression(node, parent) { if (t.isExpressionStatement(parent)) { // ({ foo: "bar" }); return true; } if (t.isMemberExpression(parent) && parent.object === node) { // ({ foo: "bar" }).foo return true; } return false; } function Binary(node, parent) { if ((t.isCallExpression(parent) || t.isNewExpression(parent)) && parent.callee === node) { return true; } if (t.isUnaryLike(parent)) { return true; } if (t.isMemberExpression(parent) && parent.object === node) { return true; } if (t.isBinary(parent)) { var parentOp = parent.operator; var parentPos = PRECEDENCE[parentOp]; var nodeOp = node.operator; var nodePos = PRECEDENCE[nodeOp]; if (parentPos > nodePos) { return true; } if (parentPos === nodePos && parent.right === node) { return true; } } } function BinaryExpression(node, parent) { if (node.operator === "in") { // var i = (1 in []); if (t.isVariableDeclarator(parent)) { return true; } // for ((1 in []);;); if (t.isFor(parent)) { return true; } } } function SequenceExpression(node, parent) { if (t.isForStatement(parent)) { // Although parentheses wouldn't hurt around sequence // expressions in the head of for loops, traditional style // dictates that e.g. i++, j++ should not be wrapped with // parentheses. return false; } if (t.isExpressionStatement(parent) && parent.expression === node) { return false; } // Otherwise err on the side of overparenthesization, adding // explicit exceptions above if this proves overzealous. return true; } function YieldExpression(node, parent) { return t.isBinary(parent) || t.isUnaryLike(parent) || t.isCallExpression(parent) || t.isMemberExpression(parent) || t.isNewExpression(parent) || t.isConditionalExpression(parent) || t.isYieldExpression(parent); } function ClassExpression(node, parent) { return t.isExpressionStatement(parent); } function UnaryLike(node, parent) { return t.isMemberExpression(parent) && parent.object === node; } function FunctionExpression(node, parent) { // function () {}; if (t.isExpressionStatement(parent)) { return true; } // (function test() {}).name; if (t.isMemberExpression(parent) && parent.object === node) { return true; } // (function () {})(); if (t.isCallExpression(parent) && parent.callee === node) { return true; } } function ConditionalExpression(node, parent) { if (t.isUnaryLike(parent)) { return true; } if (t.isBinary(parent)) { return true; } if (t.isCallExpression(parent) || t.isNewExpression(parent)) { if (parent.callee === node) { return true; } } if (t.isConditionalExpression(parent) && parent.test === node) { return true; } if (t.isMemberExpression(parent) && parent.object === node) { return true; } return false; } function AssignmentExpression(node) { if (t.isObjectPattern(node.left)) { return true; } else { return ConditionalExpression.apply(undefined, arguments); } }