diff options
Diffstat (limited to 'chromium/third_party/node/node_modules/@babel/types/lib/builders/flow/createFlowUnionType.js')
-rw-r--r-- | chromium/third_party/node/node_modules/@babel/types/lib/builders/flow/createFlowUnionType.js | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/chromium/third_party/node/node_modules/@babel/types/lib/builders/flow/createFlowUnionType.js b/chromium/third_party/node/node_modules/@babel/types/lib/builders/flow/createFlowUnionType.js new file mode 100644 index 00000000000..ddf20fdd3ae --- /dev/null +++ b/chromium/third_party/node/node_modules/@babel/types/lib/builders/flow/createFlowUnionType.js @@ -0,0 +1,20 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = createFlowUnionType; + +var _generated = require("../generated"); + +var _removeTypeDuplicates = require("../../modifications/flow/removeTypeDuplicates"); + +function createFlowUnionType(types) { + const flattened = (0, _removeTypeDuplicates.default)(types); + + if (flattened.length === 1) { + return flattened[0]; + } else { + return (0, _generated.unionTypeAnnotation)(flattened); + } +}
\ No newline at end of file |