UNPKG

@s-hiroshi/bks

Version:

Cli bookmarks application

20 lines 581 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.parseSite = void 0; /** * @param value string */ const parseSite = (value) => { // @see https://livra.geolocation.co.jp/iplearning/1816/ const isDomain = value.trim().match(/([A-Za-z0-9][A-Za-z0-9\-]{1,61}[A-Za-z0-9]\.)+[A-Za-z]/); if (!isDomain) { return false; } const matched = value.trim().match(/^https?:\/\//); if (matched) { return value; } return `https://${value}`; }; exports.parseSite = parseSite; //# sourceMappingURL=parseSite.js.map