packages/babel-types/scripts/utils/formatBuilderName.js
raw| 1 | const toLowerCase = Function.call.bind("".toLowerCase); |
| 2 | |
| 3 | export default function formatBuilderName(type) { |
| 4 | // FunctionExpression -> functionExpression |
| 5 | // JSXIdentifier -> jsxIdentifier |
| 6 | // V8IntrinsicIdentifier -> v8IntrinsicIdentifier |
| 7 | return type.replace(/^([A-Z](?=[a-z0-9])|[A-Z]+(?=[A-Z]))/, toLowerCase); |
| 8 | } |