@babel/types
Advanced tools
Comparing version 7.0.0-beta.5 to 7.0.0-beta.31
@@ -14,4 +14,2 @@ "use strict"; | ||
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } | ||
(0, _index2.default)("ArrayExpression", { | ||
@@ -252,4 +250,3 @@ fields: { | ||
exports.functionCommon = functionCommon; | ||
var functionDeclarationCommon = _extends({}, functionCommon, { | ||
var functionDeclarationCommon = Object.assign({}, functionCommon, { | ||
declare: { | ||
@@ -264,3 +261,2 @@ validate: (0, _index2.assertValueType)("boolean"), | ||
}); | ||
exports.functionDeclarationCommon = functionDeclarationCommon; | ||
@@ -270,3 +266,3 @@ (0, _index2.default)("FunctionDeclaration", { | ||
visitor: ["id", "params", "body", "returnType", "typeParameters"], | ||
fields: _extends({}, functionDeclarationCommon, { | ||
fields: Object.assign({}, functionDeclarationCommon, { | ||
body: { | ||
@@ -281,3 +277,3 @@ validate: (0, _index2.assertNodeType)("BlockStatement") | ||
aliases: ["Scopable", "Function", "BlockParent", "FunctionParent", "Expression", "Pureish"], | ||
fields: _extends({}, functionCommon, { | ||
fields: Object.assign({}, functionCommon, { | ||
id: { | ||
@@ -306,3 +302,3 @@ validate: (0, _index2.assertNodeType)("Identifier"), | ||
aliases: ["Expression", "PatternLike", "LVal", "TSEntityName"], | ||
fields: _extends({}, patternLikeCommon, { | ||
fields: Object.assign({}, patternLikeCommon, { | ||
name: { | ||
@@ -470,3 +466,3 @@ validate: function validate(node, key, val) { | ||
builder: ["kind", "key", "params", "body", "computed"], | ||
fields: _extends({}, functionCommon, { | ||
fields: Object.assign({}, functionCommon, { | ||
kind: { | ||
@@ -536,3 +532,3 @@ validate: (0, _index2.chain)((0, _index2.assertValueType)("string"), (0, _index2.assertOneOf)("method", "get", "set")), | ||
aliases: ["LVal", "PatternLike"], | ||
fields: _extends({}, patternLikeCommon, { | ||
fields: Object.assign({}, patternLikeCommon, { | ||
argument: { | ||
@@ -539,0 +535,0 @@ validate: (0, _index2.assertNodeType)("LVal") |
@@ -12,4 +12,2 @@ "use strict"; | ||
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } | ||
(0, _index.default)("AssignmentPattern", { | ||
@@ -19,3 +17,3 @@ visitor: ["left", "right"], | ||
aliases: ["Pattern", "PatternLike", "LVal"], | ||
fields: _extends({}, _core.patternLikeCommon, { | ||
fields: Object.assign({}, _core.patternLikeCommon, { | ||
left: { | ||
@@ -36,3 +34,3 @@ validate: (0, _index.assertNodeType)("Identifier", "ObjectPattern", "ArrayPattern") | ||
aliases: ["Pattern", "PatternLike", "LVal"], | ||
fields: _extends({}, _core.patternLikeCommon, { | ||
fields: Object.assign({}, _core.patternLikeCommon, { | ||
elements: { | ||
@@ -50,3 +48,3 @@ validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("PatternLike"))) | ||
aliases: ["Scopable", "Function", "BlockParent", "FunctionParent", "Expression", "Pureish"], | ||
fields: _extends({}, _core.functionCommon, { | ||
fields: Object.assign({}, _core.functionCommon, { | ||
expression: { | ||
@@ -93,3 +91,3 @@ validate: (0, _index.assertValueType)("boolean") | ||
aliases: ["Scopable", "Class", "Statement", "Declaration", "Pureish"], | ||
fields: _extends({}, classCommon, { | ||
fields: Object.assign({}, classCommon, { | ||
declare: { | ||
@@ -116,3 +114,3 @@ validate: (0, _index.assertValueType)("boolean"), | ||
aliases: ["Scopable", "Class", "Expression", "Pureish"], | ||
fields: _extends({}, classCommon, { | ||
fields: Object.assign({}, classCommon, { | ||
id: { | ||
@@ -291,4 +289,3 @@ optional: true, | ||
exports.classMethodOrPropertyCommon = classMethodOrPropertyCommon; | ||
var classMethodOrDeclareMethodCommon = _extends({}, _core.functionCommon, classMethodOrPropertyCommon, { | ||
var classMethodOrDeclareMethodCommon = Object.assign({}, _core.functionCommon, classMethodOrPropertyCommon, { | ||
kind: { | ||
@@ -307,3 +304,2 @@ validate: (0, _index.chain)((0, _index.assertValueType)("string"), (0, _index.assertOneOf)("get", "set", "method", "constructor")), | ||
}); | ||
exports.classMethodOrDeclareMethodCommon = classMethodOrDeclareMethodCommon; | ||
@@ -314,3 +310,3 @@ (0, _index.default)("ClassMethod", { | ||
visitor: ["key", "params", "body", "decorators", "returnType", "typeParameters"], | ||
fields: _extends({}, classMethodOrDeclareMethodCommon, { | ||
fields: Object.assign({}, classMethodOrDeclareMethodCommon, { | ||
body: { | ||
@@ -325,3 +321,3 @@ validate: (0, _index.assertNodeType)("BlockStatement") | ||
aliases: ["Pattern", "PatternLike", "LVal"], | ||
fields: _extends({}, _core.patternLikeCommon, { | ||
fields: Object.assign({}, _core.patternLikeCommon, { | ||
properties: { | ||
@@ -328,0 +324,0 @@ validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("RestElement", "ObjectProperty"))) |
@@ -9,4 +9,2 @@ "use strict"; | ||
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } | ||
(0, _index.default)("AwaitExpression", { | ||
@@ -31,3 +29,3 @@ builder: ["argument"], | ||
aliases: ["Property"], | ||
fields: _extends({}, _es.classMethodOrPropertyCommon, { | ||
fields: Object.assign({}, _es.classMethodOrPropertyCommon, { | ||
value: { | ||
@@ -34,0 +32,0 @@ validate: (0, _index.assertNodeType)("Expression"), |
@@ -17,4 +17,2 @@ "use strict"; | ||
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
var VISITOR_KEYS = {}; | ||
@@ -39,3 +37,3 @@ exports.VISITOR_KEYS = VISITOR_KEYS; | ||
} else { | ||
return _typeof(val); | ||
return typeof val; | ||
} | ||
@@ -42,0 +40,0 @@ } |
@@ -16,3 +16,3 @@ "use strict"; | ||
optional: true, | ||
validate: (0, _index.assertNodeType)("JSXElement", "StringLiteral", "JSXExpressionContainer") | ||
validate: (0, _index.assertNodeType)("JSXElement", "JSXFragment", "StringLiteral", "JSXExpressionContainer") | ||
} | ||
@@ -43,3 +43,3 @@ } | ||
children: { | ||
validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("JSXText", "JSXExpressionContainer", "JSXSpreadChild", "JSXElement"))) | ||
validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("JSXText", "JSXExpressionContainer", "JSXSpreadChild", "JSXElement", "JSXFragment"))) | ||
} | ||
@@ -136,2 +136,24 @@ } | ||
} | ||
}); | ||
(0, _index.default)("JSXFragment", { | ||
builder: ["openingFragment", "closingFragment", "children"], | ||
visitor: ["openingFragment", "children", "closingFragment"], | ||
aliases: ["JSX", "Immutable", "Expression"], | ||
fields: { | ||
openingFragment: { | ||
validate: (0, _index.assertNodeType)("JSXOpeningFragment") | ||
}, | ||
closingFragment: { | ||
validate: (0, _index.assertNodeType)("JSXClosingFragment") | ||
}, | ||
children: { | ||
validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("JSXText", "JSXExpressionContainer", "JSXSpreadChild", "JSXElement", "JSXFragment"))) | ||
} | ||
} | ||
}); | ||
(0, _index.default)("JSXOpeningFragment", { | ||
aliases: ["JSX", "Immutable"] | ||
}); | ||
(0, _index.default)("JSXClosingFragment", { | ||
aliases: ["JSX", "Immutable"] | ||
}); |
@@ -11,4 +11,2 @@ "use strict"; | ||
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } | ||
var bool = (0, _index.assertValueType)("boolean"); | ||
@@ -110,3 +108,3 @@ | ||
visitor: ["key", "typeAnnotation", "initializer"], | ||
fields: _extends({}, namedTypeElementCommon, { | ||
fields: Object.assign({}, namedTypeElementCommon, { | ||
readonly: validateOptional(bool), | ||
@@ -120,3 +118,3 @@ typeAnnotation: validateOptionalType("TSTypeAnnotation"), | ||
visitor: ["key", "typeParameters", "parameters", "typeAnnotation"], | ||
fields: _extends({}, signatureDeclarationCommon, namedTypeElementCommon) | ||
fields: Object.assign({}, signatureDeclarationCommon, namedTypeElementCommon) | ||
}); | ||
@@ -123,0 +121,0 @@ (0, _index.default)("TSIndexSignature", { |
@@ -28,4 +28,2 @@ "use strict"; | ||
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
function isBinding(node, parent) { | ||
@@ -210,3 +208,3 @@ var keys = _retrievers.getBindingIdentifiers.keys[parent.type]; | ||
function isNodesEquivalent(a, b) { | ||
if (_typeof(a) !== "object" || _typeof(b) !== "object" || a == null || b == null) { | ||
if (typeof a !== "object" || typeof b !== "object" || a == null || b == null) { | ||
return a === b; | ||
@@ -224,3 +222,3 @@ } | ||
if (_typeof(a[field]) !== _typeof(b[field])) { | ||
if (typeof a[field] !== typeof b[field]) { | ||
return false; | ||
@@ -227,0 +225,0 @@ } |
{ | ||
"name": "@babel/types", | ||
"version": "7.0.0-beta.5", | ||
"version": "7.0.0-beta.31", | ||
"description": "Babel Types is a Lodash-esque utility library for AST nodes", | ||
@@ -16,5 +16,5 @@ "author": "Sebastian McKenzie <sebmck@gmail.com>", | ||
"devDependencies": { | ||
"@babel/generator": "7.0.0-beta.5", | ||
"babylon": "^7.0.0-beta.30" | ||
"@babel/generator": "7.0.0-beta.31", | ||
"babylon": "7.0.0-beta.31" | ||
} | ||
} |
@@ -1062,3 +1062,3 @@ # @babel/types | ||
- `name`: `JSXIdentifier | JSXNamespacedName` (required) | ||
- `value`: `JSXElement | StringLiteral | JSXExpressionContainer` (default: `null`) | ||
- `value`: `JSXElement | JSXFragment | StringLiteral | JSXExpressionContainer` (default: `null`) | ||
@@ -1080,2 +1080,14 @@ --- | ||
### jSXClosingFragment | ||
```javascript | ||
t.jSXClosingFragment() | ||
``` | ||
See also `t.isJSXClosingFragment(node, opts)` and `t.assertJSXClosingFragment(node, opts)`. | ||
Aliases: `JSX`, `Immutable` | ||
--- | ||
### jSXElement | ||
@@ -1092,3 +1104,3 @@ ```javascript | ||
- `closingElement`: `JSXClosingElement` (default: `null`) | ||
- `children`: `Array<JSXText | JSXExpressionContainer | JSXSpreadChild | JSXElement>` (required) | ||
- `children`: `Array<JSXText | JSXExpressionContainer | JSXSpreadChild | JSXElement | JSXFragment>` (required) | ||
- `selfClosing` (required) | ||
@@ -1123,2 +1135,17 @@ | ||
### jSXFragment | ||
```javascript | ||
t.jSXFragment(openingFragment, closingFragment, children) | ||
``` | ||
See also `t.isJSXFragment(node, opts)` and `t.assertJSXFragment(node, opts)`. | ||
Aliases: `JSX`, `Immutable`, `Expression` | ||
- `openingFragment`: `JSXOpeningFragment` (required) | ||
- `closingFragment`: `JSXClosingFragment` (required) | ||
- `children`: `Array<JSXText | JSXExpressionContainer | JSXSpreadChild | JSXElement | JSXFragment>` (required) | ||
--- | ||
### jSXIdentifier | ||
@@ -1180,2 +1207,14 @@ ```javascript | ||
### jSXOpeningFragment | ||
```javascript | ||
t.jSXOpeningFragment() | ||
``` | ||
See also `t.isJSXOpeningFragment(node, opts)` and `t.assertJSXOpeningFragment(node, opts)`. | ||
Aliases: `JSX`, `Immutable` | ||
--- | ||
### jSXSpreadAttribute | ||
@@ -1182,0 +1221,0 @@ ```javascript |
3582
2836
172156