[{"data":1,"prerenderedAt":821,"buildId":822},["ShallowReactive",2],{"docs-navigation-en":3,"examples-en":30,"page-\u002Fdocs\u002Fin-the-browser":131,"surround-\u002Fdocs\u002Fin-the-browser":816},[4],{"title":5,"path":6,"stem":7,"children":8,"page":29},"Docs","\u002Fdocs","docs",[9,13,17,21,25],{"title":10,"path":11,"stem":12},"Getting started","\u002Fdocs\u002Fgetting-started","docs\u002F1.getting-started",{"title":14,"path":15,"stem":16},"In the browser and with frameworks","\u002Fdocs\u002Fin-the-browser","docs\u002F2.in-the-browser",{"title":18,"path":19,"stem":20},"Input rules","\u002Fdocs\u002Finput-rules","docs\u002F3.input-rules",{"title":22,"path":23,"stem":24},"Compared with libphonenumber","\u002Fdocs\u002Flibphonenumber","docs\u002F4.libphonenumber",{"title":26,"path":27,"stem":28},"Data and sources","\u002Fdocs\u002Fdata-and-sources","docs\u002F5.data-and-sources",false,[31,40,47,55,63,71,77,84,92,98,104,110,117,125],{"path":32,"title":33,"description":34,"category":35,"order":36,"uses":37,"demo":39},"\u002Fexamples\u002Fvalidate-input","Validate a phone number field","Accept full-width input, reject numbers that do not exist, and save one notation.","forms",1,[38],"normalize","validate-input",{"path":41,"title":42,"description":43,"category":35,"order":44,"uses":45,"demo":46},"\u002Fexamples\u002Fpaste-labels","Accept pasted labels and notes","Take the main number from lines like ",2,[38],"paste-labels",{"path":48,"title":49,"description":50,"category":35,"order":51,"uses":52,"demo":54},"\u002Fexamples\u002Fmobile-only","Accept mobile numbers only","Use the type to decide whether a number can receive SMS.",3,[38,53],"type","mobile-only",{"path":56,"title":57,"description":58,"category":35,"order":59,"uses":60,"demo":62},"\u002Fexamples\u002Ftel-link","Make tel: links","Link numbers in their international form, and keep domestic-only numbers dialable.",4,[38,61],"international","tel-link",{"path":64,"title":65,"description":66,"category":67,"order":36,"uses":68,"demo":70},"\u002Fexamples\u002Fextract-inquiry","Find numbers in a message","Pick every phone number out of a message, in the order it appears.","text",[69],"extract","extract-inquiry",{"path":72,"title":73,"description":74,"category":67,"order":44,"uses":75,"demo":76},"\u002Fexamples\u002Fbusiness-card","Read a business card in kanji digits","Find numbers written with 〇一二三, as on vertical business cards.",[69],"business-card",{"path":78,"title":79,"description":80,"category":67,"order":51,"uses":81,"demo":83},"\u002Fexamples\u002Fcompany-page","List the numbers on a company page","Find TEL and FAX numbers and drop duplicates written in other notations.",[69,82],"digits","company-page",{"path":85,"title":86,"description":87,"category":88,"order":36,"uses":89,"demo":91},"\u002Fexamples\u002Fdisplay-format","Store digits, show hyphens","Format stored digits with the groups from the numbering table.","data",[38,90],"national","display-format",{"path":93,"title":94,"description":95,"category":88,"order":44,"uses":96,"demo":97},"\u002Fexamples\u002Fdedupe","Find duplicates written differently","Group entries that are the same number in different notations.",[38],"dedupe",{"path":99,"title":100,"description":101,"category":88,"order":51,"uses":102,"demo":103},"\u002Fexamples\u002Fcsv-cleanup","Clean a CSV column","Rewrite a phone column in one notation and flag rows that need a person.",[38],"csv-cleanup",{"path":105,"title":106,"description":107,"category":88,"order":59,"uses":108,"demo":109},"\u002Fexamples\u002Ftype-stats","Count numbers by type","See how many entries are mobile, fixed-line, toll-free, or invalid.",[38,53],"type-stats",{"path":111,"title":112,"description":113,"category":88,"order":114,"uses":115,"demo":116},"\u002Fexamples\u002Fe164","Convert to E.164","Pass numbers to SMS gateways, CRMs, and libphonenumber in international form.",5,[38,61],"e164",{"path":118,"title":119,"description":120,"category":121,"order":36,"uses":122,"demo":124},"\u002Fexamples\u002Fplan-check","Reject numbers that cannot exist","Numbers missing from the numbering plan or the MIC tables are invalid.","rules",[123],"isValid","plan-check",{"path":126,"title":127,"description":128,"category":121,"order":44,"uses":129,"demo":130},"\u002Fexamples\u002Finternational-input","Read numbers written for abroad","Accept +81 notation, including the bracketed (0), for the types that can be dialed from abroad.",[38],"international-input",{"id":132,"title":14,"body":133,"description":811,"extension":812,"meta":813,"navigation":270,"path":15,"seo":814,"stem":16,"__hash__":815},"docs_en\u002Fdocs\u002F2.in-the-browser.md",{"type":134,"value":135,"toc":807},"minimark",[136,140,150,155,161,757,796,800,803],[137,138,139],"p",{},"The npm package is the same in Node.js and in the browser. The numbering table is bundled as a JavaScript module, so the package reads no files and makes no requests. Import it with Vite, webpack, or any other bundler like any other package. With the table, it is about 14 KB gzipped.",[137,141,142,143,146,147,149],{},"japan-phone is not tied to any framework. ",[144,145,38],"code",{}," and ",[144,148,69],{}," are plain functions that take a string and return a result. Call them wherever your framework derives a value from input. No framework-specific package or setup is needed.",[151,152,154],"h2",{"id":153},"in-an-input-field","In an input field",[137,156,157,158,160],{},"Call ",[144,159,38],{}," on each change, and show either the formatted number or a prompt to check it.",[162,163,164,472],"code-group",{},[165,166,172],"pre",{"className":167,"code":168,"filename":169,"language":170,"meta":171,"style":171},"language-vue shiki shiki-themes material-theme-lighter github-light github-dark","\u003Cscript setup lang=\"ts\">\nimport { computed, ref } from \"vue\";\nimport { normalize } from \"@kurashina-design\u002Fjapan-phone\";\n\nconst input = ref(\"\");\nconst phone = computed(() => normalize(input.value));\n\u003C\u002Fscript>\n\n\u003Ctemplate>\n  \u003Cinput v-model=\"input\" type=\"tel\" autocomplete=\"tel\">\n  \u003Cp v-if=\"phone\">{{ phone.national }}\u003C\u002Fp>\n  \u003Cp v-else-if=\"input\">Please check the phone number.\u003C\u002Fp>\n\u003C\u002Ftemplate>\n","Vue","vue","",[144,173,174,209,244,266,272,300,333,343,348,358,403,434,463],{"__ignoreMap":171},[175,176,178,182,186,190,193,196,200,204,206],"span",{"class":177,"line":36},"line",[175,179,181],{"class":180},"sP7_E","\u003C",[175,183,185],{"class":184},"sQzsp","script",[175,187,189],{"class":188},"s9AJx"," setup",[175,191,192],{"class":188}," lang",[175,194,195],{"class":180},"=",[175,197,199],{"class":198},"sjJ54","\"",[175,201,203],{"class":202},"s_sjI","ts",[175,205,199],{"class":198},[175,207,208],{"class":180},">\n",[175,210,211,215,218,222,225,228,231,234,237,239,241],{"class":177,"line":44},[175,212,214],{"class":213},"sVHd0","import",[175,216,217],{"class":180}," {",[175,219,221],{"class":220},"su5hD"," computed",[175,223,224],{"class":180},",",[175,226,227],{"class":220}," ref",[175,229,230],{"class":180}," }",[175,232,233],{"class":213}," from",[175,235,236],{"class":198}," \"",[175,238,170],{"class":202},[175,240,199],{"class":198},[175,242,243],{"class":180},";\n",[175,245,246,248,250,253,255,257,259,262,264],{"class":177,"line":51},[175,247,214],{"class":213},[175,249,217],{"class":180},[175,251,252],{"class":220}," normalize",[175,254,230],{"class":180},[175,256,233],{"class":213},[175,258,236],{"class":198},[175,260,261],{"class":202},"@kurashina-design\u002Fjapan-phone",[175,263,199],{"class":198},[175,265,243],{"class":180},[175,267,268],{"class":177,"line":59},[175,269,271],{"emptyLinePlaceholder":270},true,"\n",[175,273,274,278,282,286,289,292,295,298],{"class":177,"line":114},[175,275,277],{"class":276},"sbsja","const",[175,279,281],{"class":280},"s_hVV"," input",[175,283,285],{"class":284},"smGrS"," =",[175,287,227],{"class":288},"sGLFI",[175,290,291],{"class":220},"(",[175,293,294],{"class":198},"\"\"",[175,296,297],{"class":220},")",[175,299,243],{"class":180},[175,301,303,305,308,310,312,314,317,320,322,325,328,331],{"class":177,"line":302},6,[175,304,277],{"class":276},[175,306,307],{"class":280}," phone",[175,309,285],{"class":284},[175,311,221],{"class":288},[175,313,291],{"class":220},[175,315,316],{"class":180},"()",[175,318,319],{"class":276}," =>",[175,321,252],{"class":288},[175,323,324],{"class":220},"(input",[175,326,327],{"class":180},".",[175,329,330],{"class":220},"value))",[175,332,243],{"class":180},[175,334,336,339,341],{"class":177,"line":335},7,[175,337,338],{"class":180},"\u003C\u002F",[175,340,185],{"class":184},[175,342,208],{"class":180},[175,344,346],{"class":177,"line":345},8,[175,347,271],{"emptyLinePlaceholder":270},[175,349,351,353,356],{"class":177,"line":350},9,[175,352,181],{"class":180},[175,354,355],{"class":184},"template",[175,357,208],{"class":180},[175,359,361,364,367,370,372,374,376,378,381,383,385,388,390,393,395,397,399,401],{"class":177,"line":360},10,[175,362,363],{"class":180},"  \u003C",[175,365,366],{"class":184},"input",[175,368,369],{"class":188}," v-model",[175,371,195],{"class":180},[175,373,199],{"class":198},[175,375,366],{"class":202},[175,377,199],{"class":198},[175,379,380],{"class":188}," type",[175,382,195],{"class":180},[175,384,199],{"class":198},[175,386,387],{"class":202},"tel",[175,389,199],{"class":198},[175,391,392],{"class":188}," autocomplete",[175,394,195],{"class":180},[175,396,199],{"class":198},[175,398,387],{"class":202},[175,400,199],{"class":198},[175,402,208],{"class":180},[175,404,406,408,410,413,415,417,420,422,425,428,430,432],{"class":177,"line":405},11,[175,407,363],{"class":180},[175,409,137],{"class":184},[175,411,412],{"class":188}," v-if",[175,414,195],{"class":180},[175,416,199],{"class":198},[175,418,419],{"class":202},"phone",[175,421,199],{"class":198},[175,423,424],{"class":180},">",[175,426,427],{"class":220},"{{ phone.national }}",[175,429,338],{"class":180},[175,431,137],{"class":184},[175,433,208],{"class":180},[175,435,437,439,441,444,446,448,450,452,454,457,459,461],{"class":177,"line":436},12,[175,438,363],{"class":180},[175,440,137],{"class":184},[175,442,443],{"class":188}," v-else-if",[175,445,195],{"class":180},[175,447,199],{"class":198},[175,449,366],{"class":202},[175,451,199],{"class":198},[175,453,424],{"class":180},[175,455,456],{"class":220},"Please check the phone number.",[175,458,338],{"class":180},[175,460,137],{"class":184},[175,462,208],{"class":180},[175,464,466,468,470],{"class":177,"line":465},13,[175,467,338],{"class":180},[175,469,355],{"class":184},[175,471,208],{"class":180},[165,473,478],{"className":474,"code":475,"filename":476,"language":477,"meta":171,"style":171},"language-tsx shiki shiki-themes material-theme-lighter github-light github-dark","import { useState } from \"react\";\nimport { normalize } from \"@kurashina-design\u002Fjapan-phone\";\n\nexport function PhoneField() {\n  const [input, setInput] = useState(\"\");\n  const phone = normalize(input);\n\n  return (\n    \u003C>\n      \u003Cinput type=\"tel\" autoComplete=\"tel\" value={input} onChange={(event) => setInput(event.target.value)} \u002F>\n      {phone ? \u003Cp>{phone.national}\u003C\u002Fp> : input && \u003Cp>Please check the phone number.\u003C\u002Fp>}\n    \u003C\u002F>\n  );\n}\n","React","tsx",[144,479,480,502,522,526,542,573,591,595,603,608,683,739,744,751],{"__ignoreMap":171},[175,481,482,484,486,489,491,493,495,498,500],{"class":177,"line":36},[175,483,214],{"class":213},[175,485,217],{"class":180},[175,487,488],{"class":220}," useState",[175,490,230],{"class":180},[175,492,233],{"class":213},[175,494,236],{"class":198},[175,496,497],{"class":202},"react",[175,499,199],{"class":198},[175,501,243],{"class":180},[175,503,504,506,508,510,512,514,516,518,520],{"class":177,"line":44},[175,505,214],{"class":213},[175,507,217],{"class":180},[175,509,252],{"class":220},[175,511,230],{"class":180},[175,513,233],{"class":213},[175,515,236],{"class":198},[175,517,261],{"class":202},[175,519,199],{"class":198},[175,521,243],{"class":180},[175,523,524],{"class":177,"line":51},[175,525,271],{"emptyLinePlaceholder":270},[175,527,528,531,534,537,539],{"class":177,"line":59},[175,529,530],{"class":213},"export",[175,532,533],{"class":276}," function",[175,535,536],{"class":288}," PhoneField",[175,538,316],{"class":180},[175,540,541],{"class":180}," {\n",[175,543,544,547,550,552,554,557,560,562,564,567,569,571],{"class":177,"line":114},[175,545,546],{"class":276},"  const",[175,548,549],{"class":180}," [",[175,551,366],{"class":280},[175,553,224],{"class":180},[175,555,556],{"class":280}," setInput",[175,558,559],{"class":180},"]",[175,561,285],{"class":284},[175,563,488],{"class":288},[175,565,291],{"class":566},"skxfh",[175,568,294],{"class":198},[175,570,297],{"class":566},[175,572,243],{"class":180},[175,574,575,577,579,581,583,585,587,589],{"class":177,"line":302},[175,576,546],{"class":276},[175,578,307],{"class":280},[175,580,285],{"class":284},[175,582,252],{"class":288},[175,584,291],{"class":566},[175,586,366],{"class":220},[175,588,297],{"class":566},[175,590,243],{"class":180},[175,592,593],{"class":177,"line":335},[175,594,271],{"emptyLinePlaceholder":270},[175,596,597,600],{"class":177,"line":345},[175,598,599],{"class":213},"  return",[175,601,602],{"class":566}," (\n",[175,604,605],{"class":177,"line":350},[175,606,607],{"class":180},"    \u003C>\n",[175,609,610,613,615,617,619,621,623,625,628,630,632,634,636,639,641,644,646,649,652,654,657,661,663,665,667,670,672,675,677,680],{"class":177,"line":360},[175,611,612],{"class":180},"      \u003C",[175,614,366],{"class":184},[175,616,380],{"class":188},[175,618,195],{"class":284},[175,620,199],{"class":198},[175,622,387],{"class":202},[175,624,199],{"class":198},[175,626,627],{"class":188}," autoComplete",[175,629,195],{"class":284},[175,631,199],{"class":198},[175,633,387],{"class":202},[175,635,199],{"class":198},[175,637,638],{"class":188}," value",[175,640,195],{"class":284},[175,642,643],{"class":180},"{",[175,645,366],{"class":220},[175,647,648],{"class":180},"} ",[175,650,651],{"class":188},"onChange",[175,653,195],{"class":284},[175,655,656],{"class":180},"{(",[175,658,660],{"class":659},"s99_P","event",[175,662,297],{"class":180},[175,664,319],{"class":276},[175,666,556],{"class":288},[175,668,669],{"class":220},"(event",[175,671,327],{"class":180},[175,673,674],{"class":220},"target",[175,676,327],{"class":180},[175,678,679],{"class":220},"value)",[175,681,682],{"class":180},"} \u002F>\n",[175,684,685,688,691,694,697,699,702,704,706,708,711,713,715,718,721,724,726,728,730,732,734,736],{"class":177,"line":405},[175,686,687],{"class":180},"      {",[175,689,690],{"class":220},"phone ",[175,692,693],{"class":284},"?",[175,695,696],{"class":180}," \u003C",[175,698,137],{"class":184},[175,700,701],{"class":180},">{",[175,703,419],{"class":220},[175,705,327],{"class":180},[175,707,90],{"class":220},[175,709,710],{"class":180},"}\u003C\u002F",[175,712,137],{"class":184},[175,714,424],{"class":180},[175,716,717],{"class":284}," :",[175,719,720],{"class":220}," input ",[175,722,723],{"class":284},"&&",[175,725,696],{"class":180},[175,727,137],{"class":184},[175,729,424],{"class":180},[175,731,456],{"class":220},[175,733,338],{"class":180},[175,735,137],{"class":184},[175,737,738],{"class":180},">}\n",[175,740,741],{"class":177,"line":436},[175,742,743],{"class":180},"    \u003C\u002F>\n",[175,745,746,749],{"class":177,"line":465},[175,747,748],{"class":566},"  )",[175,750,243],{"class":180},[175,752,754],{"class":177,"line":753},14,[175,755,756],{"class":180},"}\n",[758,759,760,768,782],"ul",{},[761,762,763,764,767],"li",{},"In Vue, ",[144,765,766],{},"computed"," recalculates only when the input changes. In React, calling it on every render is fine: one check is cheap.",[761,769,770,771,774,775,778,779,781],{},"The same call works in Svelte's ",[144,772,773],{},"$derived",", Solid's ",[144,776,777],{},"createMemo",", Angular's ",[144,780,766],{},", and so on.",[761,783,784,785,787,788,790,791,327],{},"To store the number, use ",[144,786,90],{}," for display or ",[144,789,82],{}," for digits only. See the ",[792,793,795],"a",{"href":794},"\u002Fexamples","examples",[151,797,799],{"id":798},"server-side-rendering","Server-side rendering",[137,801,802],{},"The same package runs unchanged in server-side rendering (Nuxt, Next.js, and others). The server and the browser use the same table, so their results match.",[804,805,806],"style",{},"html pre.shiki code .sP7_E, html code.shiki .sP7_E{--shiki-light:#39ADB5;--shiki-default:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .sQzsp, html code.shiki .sQzsp{--shiki-light:#E53935;--shiki-default:#22863A;--shiki-dark:#85E89D}html pre.shiki code .s9AJx, html code.shiki .s9AJx{--shiki-light:#9C3EDA;--shiki-default:#6F42C1;--shiki-dark:#B392F0}html pre.shiki code .sjJ54, html code.shiki .sjJ54{--shiki-light:#39ADB5;--shiki-default:#032F62;--shiki-dark:#9ECBFF}html pre.shiki code .s_sjI, html code.shiki .s_sjI{--shiki-light:#91B859;--shiki-default:#032F62;--shiki-dark:#9ECBFF}html pre.shiki code .sVHd0, html code.shiki .sVHd0{--shiki-light:#39ADB5;--shiki-light-font-style:italic;--shiki-default:#D73A49;--shiki-default-font-style:inherit;--shiki-dark:#F97583;--shiki-dark-font-style:inherit}html pre.shiki code .su5hD, html code.shiki .su5hD{--shiki-light:#90A4AE;--shiki-default:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .sbsja, html code.shiki .sbsja{--shiki-light:#9C3EDA;--shiki-default:#D73A49;--shiki-dark:#F97583}html pre.shiki code .s_hVV, html code.shiki .s_hVV{--shiki-light:#90A4AE;--shiki-default:#005CC5;--shiki-dark:#79B8FF}html pre.shiki code .smGrS, html code.shiki .smGrS{--shiki-light:#39ADB5;--shiki-default:#D73A49;--shiki-dark:#F97583}html pre.shiki code .sGLFI, html code.shiki .sGLFI{--shiki-light:#6182B8;--shiki-default:#6F42C1;--shiki-dark:#B392F0}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .skxfh, html code.shiki .skxfh{--shiki-light:#E53935;--shiki-default:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .s99_P, html code.shiki .s99_P{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#E36209;--shiki-default-font-style:inherit;--shiki-dark:#FFAB70;--shiki-dark-font-style:inherit}",{"title":171,"searchDepth":44,"depth":44,"links":808},[809,810],{"id":153,"depth":44,"text":154},{"id":798,"depth":44,"text":799},"The npm package runs unchanged in the browser. Examples for an input field in Vue and React.","md",{},{"title":14,"description":811},"11_6eXMxZeYKoXTjy9BO054oBy7Mjny2a3HcjKPACXM",[817,819],{"title":10,"path":11,"stem":12,"description":818,"children":-1},"Install japan-phone for Node.js, Python, or Java and learn its three functions.",{"title":18,"path":19,"stem":20,"description":820,"children":-1},"What normalize and extract accept, and what they reject on purpose.",1796483608337,"73e0e014-4aa7-4f04-8db5-5f7391793162"]