PageSourceSearch

https://nosh.jp/js/chefly/common/loginValidalidation.js

js nosh.jp collected 2026-09-24 09:01:58 UTC 1,115 bytes, 42 lines download raw bytes

1// メールアドレスチェック
2const isValidEmail = (value) => {
3    // 要素の生成
4    const input = document.createElement('input');
5    input.type = 'email';
6    input.value = value;
7    // チェック
8    const result = input.checkValidity();
9    // 要素の削除
10    input.remove();
11
12    return result;
13};
14
15// ハイフン除去
16const sanitizePhoneNumber = (value) => {
17    return value.replace(/-/g, '');
18};
19
20// 電話番号チェック
21const isValidPhoneNumber = (value) => {
22    // ハイフンを除去
23    const sanitizedValue = sanitizePhoneNumber(value);
24    // 要素の生成
25    const input = document.createElement('input');
26    input.type = 'tel';
27    input.pattern = '\\d{10,11}';
28    input.value = sanitizedValue;
29    // チェック
30    const result = input.checkValidity();
31    // 要素の削除
32    input.remove();
33
34    return result;
35};
36
37// メールアドレスまたは電話番号チェックを通るか?
38const isValidLoginId = (value) => {
39    return isValidEmail(value) || isValidPhoneNumber(value);
40};
41
42export {isValidLoginId, isValidPhoneNumber, sanitizePhoneNumber};

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.