PageSourceSearch

https://babeljs.io/assets/js/e77a58b5.b974e72a.js

js babeljs.io collected 2026-09-24 06:56:13 UTC 9,442 bytes, 2 lines download raw bytes

1"use strict";(self.webpackChunk=self.webpackChunk||[]).push([["32608"],{99550:function(e,n,a){a.r(n),a.d(n,{metadata:function(){return r},default:function(){return h},frontMatter:function(){return u},contentTitle:function(){return o},toc:function(){return d},assets:function(){return c}});var r=JSON.parse('{"id":"babel-plugin-syntax-numeric-separator","title":"@babel/plugin-syntax-numeric-separator","description":"Syntax only","source":"@site/../docs/plugin-syntax-numeric-separator.md","sourceDirName":".","slug":"/babel-plugin-syntax-numeric-separator","permalink":"/docs/babel-plugin-syntax-numeric-separator","draft":false,"unlisted":false,"editUrl":"https://github.com/babel/website/edit/main/docs/../docs/plugin-syntax-numeric-separator.md","tags":[],"version":"current","frontMatter":{"id":"babel-plugin-syntax-numeric-separator","title":"@babel/plugin-syntax-numeric-separator","sidebar_label":"syntax-numeric-separator"}}'),t=a(62540),l=a(43023),i=a(77779),s=a(98263);let u={id:"babel-plugin-syntax-numeric-separator",title:"@babel/plugin-syntax-numeric-separator",sidebar_label:"syntax-numeric-separator"},o,c={},d=[{value:"Syntax only",id:"syntax-only",level:4},{value:"Installation",id:"installation",level:2},{value:"Usage",id:"usage",level:2},{value:"With a configuration file (Recommended)",id:"with-a-configuration-file-recommended",level:3},{value:"Via CLI",id:"via-cli",level:3},{value:"Via Node API",id:"via-node-api",level:3}];function p(e){let n={a:"a",admonition:"admonition",code:"code",em:"em",h2:"h2",h3:"h3",h4:"h4",p:"p",pre:"pre",...(0,l.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(n.admonition,{type:"note",children:[(0,t.jsx)(n.h4,{id:"syntax-only",children:"Syntax only"}),(0,t.jsxs)(n.p,{children:["It's unlikely you want to use this plugin directly as it only enables Babel to parse this syntax. Instead, use ",(0,t.jsx)(n.a,{href:"/docs/babel-plugin-transform-numeric-separator",children:"plugin-transform-numeric-separator"})," to ",(0,t.jsx)(n.em,{children:"both"})," parse and transform this syntax."]})]}),"\n",(0,t.jsx)(n.h2,{id:"installation",children:"Installation"}),"\n",(0,t.jsxs)(i.A,{groupId:"npm2yarn",children:[(0,t.jsx)(s.A,{value:"npm",children:(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-shell",children:"npm install --save-dev @babel/plugin-syntax-numeric-separator\n"})})}),(0,t.jsx)(s.A,{value:"yarn",label:"Yarn",children:(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-shell",children:"yarn add --dev @babel/plugin-syntax-numeric-separator\n"})})}),(0,t.jsx)(s.A,{value:"pnpm",label:"pnpm",children:(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-shell",children:"pnpm add --save-dev @babel/plugin-syntax-numeric-separator\n"})})}),(0,t.jsx)(s.A,{value:"bun",label:"Bun",children:(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-shell",children:"bun add --dev @babel/plugin-syntax-numeric-separator\n"})})})]}),"\n",(0,t.jsx)(n.h2,{id:"usage",children:"Usage"}),"\n",(0,t.jsx)(n.h3,{id:"with-a-configuration-file-recommended",children:"With a configuration file (Recommended)"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-json",metastring:'title="babel.config.json"',children:'{\n  "plugins": ["@babel/plugin-syntax-numeric-separator"]\n}\n'})}),"\n",(0,t.jsx)(n.h3,{id:"via-cli",children:"Via CLI"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-sh",metastring:'title="Shell"',children:"babel --plugins @babel/plugin-syntax-numeric-separator script.js\n"})}),"\n",(0,t.jsx)(n.h3,{id:"via-node-api",children:"Via Node API"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",metastring:'title="JavaScript"',children:'require("@babel/core").transformSync("code", {\n  plugins: ["@babel/plugin-syntax-numeric-separator"]\n});\n'})})]})}function h(e={}){let{wrapper:n}={...(0,l.R)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(p,{...e})}):p(e)}},98263:function(e,n,a){a.d(n,{A:function(){return s}});var r=a(62540);a(63696);var t=a(11750),l=a(23865);function i({children:e,className:n,hidden:a}){return(0,r.jsx)("div",{role:"tabpanel",className:(0,t.A)("tabItem_wHwb",n),hidden:a,children:e})}function s({children:e,className:n,value:a}){let{selectedValue:t,lazy:u}=(0,l.uc)(),o=a===t;return!o&&u?null:(0,r.jsx)(i,{className:n,hidden:!o,children:e})}},77779:function(e,n,a){a.d(n,{A:function(){return p}});var r=a(62540);a(63696);var t=a(11750),l=a(46065),i=a(23865),s=a(45194),u=a(83029);function o({className:e}){let{selectedValue:n,selectValue:a,tabValues:l,block:u}=(0,i.uc)(),c=[],{blockElementScrollPositionUntilNextRender:d}=(0,s.a_)(),p=e=>{let r=e.currentTarget,t=l[c.indexOf(r)].value;t!==n&&(d(r),a(t))}
1,h=e=>{let n=null;switch(e.key){case"Enter":p(e);break;case"ArrowRight":{let a=c.indexOf(e.currentTarget)+1;n=c[a]??c[0];break}case"ArrowLeft":{let a=c.indexOf(e.currentTarget)-1;n=c[a]??c[c.length-1]}}n?.focus()};return(0,r.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,t.A)("tabs",{"tabs--block":u},e),children:l.map(({value:e,label:a,attributes:l})=>(0,r.jsx)("li",{role:"tab",tabIndex:n===e?0:-1,"aria-selected":n===e,ref:e=>{c.push(e)},onKeyDown:h,onClick:p,...l,className:(0,t.A)("tabs__item","tabItem_l0OV",l?.className,{"tabs__item--active":n===e}),children:a??e},e))})}function c({children:e}){return(0,r.jsx)("div",{className:"margin-top--md",children:e})}function d({className:e,children:n}){return(0,r.jsxs)("div",{className:(0,t.A)(l.G.tabs.container,"tabs-container","tabList_J5MA"),children:[(0,r.jsx)(o,{className:e}),(0,r.jsx)(c,{children:n})]})}function p(e){let n=(0,u.A)(),a=(0,i.OC)(e);return(0,r.jsx)(i.O_,{value:a,children:(0,r.jsx)(d,{className:e.className,children:(0,i.vT)(e.children)})},String(n))}},23865:function(e,n,a){a.d(n,{OC:function(){return p},O_:function(){return f},uc:function(){return m},vT:function(){return c}});var r=a(62540),t=a(63696),l=a(49519),i=a(6743),s=a(88511),u=a(15396),o=a(89030);function c(e){return t.Children.toArray(e).filter(e=>"\n"!==e)}function d({value:e,tabValues:n}){return n.some(n=>n.value===e)}function p(e){let n,{defaultValue:a,queryString:r=!1,groupId:c}=e,p=function(e){let{values:n,children:a}=e;return(0,t.useMemo)(()=>{let e=n??t.Children.toArray(a).flatMap(e=>{if(!e)return[];if((0,t.isValidElement)(e)&&function(e){let{props:n}=e;return!!n&&"object"==typeof n&&"value"in n}(e))return[e];let n="string"==typeof e.type?e.type:e.type.name;throw Error(`Docusaurus error: Bad <Tabs> child <${n}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.
2If you do not want to pass on a "value" prop to the direct children of <Tabs>, you can also pass an explicit <Tabs values={...}> prop.`)}).map(({props:{value:e,label:n,attributes:a,default:r}})=>({value:e,label:n,attributes:a,default:r})),r=(0,u.XI)(e,(e,n)=>e.value===n.value);if(r.length>0)throw Error(`Docusaurus error: Duplicate values "${r.map(e=>`'${e.value}'`).join(", ")}" found in <Tabs>. Every value needs to be unique.`);return e},[n,a])}(e),[h,m]=(0,t.useState)(()=>(function({defaultValue:e,tabValues:n}){if(0===n.length)throw Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(e){if(!d({value:e,tabValues:n}))throw Error(`Docusaurus error: The <Tabs> has a defaultValue "${e}" but none of its children has the corresponding value. Available values are: ${n.map(e=>e.value).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return e}let a=n.find(e=>e.default)??n[0];if(!a)throw Error("Unexpected error: 0 tabValues");return a.value})({defaultValue:a,tabValues:p})),[f,b]=function({queryString:e=!1,groupId:n}){let a=(0,l.W6)(),r=function({queryString:e=!1,groupId:n}){if("string"==typeof e)return e;if(!1===e)return null;if(!0===e&&!n)throw Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:e,groupId:n});return[(0,s.aZ)(r),(0,t.useCallback)(e=>{if(!r)return;let n=new URLSearchParams(a.location.search);n.set(r,e),a.replace({...a.location,search:n.toString()})},[r,a])]}({queryString:r,groupId:c}),[x,v]=function({groupId:e}){let n=e?`docusaurus.tab.${e}`:null,[a,r]=(0,o.Dv)(n);return[a,(0,t.useCallback)(e=>{n&&r.set(e)},[n,r])]}({groupId:c}),g=d({value:n=f??x,tabValues:p})?n:null;return(0,i.A)(()=>{g&&m(g)},[g]),{selectedValue:h,selectValue:(0,t.useCallback)(e=>{if(!d({value:e,tabValues:p}))throw Error(`Can't select invalid tab value=${e}`);m(e),b(e),v(e)},[b,v,p]),tabValues:p,lazy:e.lazy??!1,block:e.block??!1}}let h=(0,t.createContext)(null);function m(){let e=t.useContext(h);if(!e)throw Error("useTabsContext() must be used within a Tabs component");return e}function f(e){return(0,r.jsx)(h.Provider,{value:e.value,children:e.children})}},43023:function(e,n,a){a.d(n,{R:function(){return i},x:function(){return s}});var r=a(63696);let t={},l=r.createContext(t);function i(e){let n=r.useContext(l);return r.useMemo(function(){return"function"==typeof e?e(n):{...n,...e}},[n,e])}function s(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(t):e.components||t:i(e.components),r.createElement(l.Provider,{value:n},e.children)}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.