UNPKG

494 BJavaScriptView Raw
1
2
3
4
5
6
7
8
9
10export default function getJSXPragmaInfo(options) {
11 const [base, suffix] = splitPragma(options.jsxPragma || "React.createElement");
12 const [fragmentBase, fragmentSuffix] = splitPragma(options.jsxFragmentPragma || "React.Fragment");
13 return {base, suffix, fragmentBase, fragmentSuffix};
14}
15
16function splitPragma(pragma) {
17 let dotIndex = pragma.indexOf(".");
18 if (dotIndex === -1) {
19 dotIndex = pragma.length;
20 }
21 return [pragma.slice(0, dotIndex), pragma.slice(dotIndex)];
22}