UNPKG

@kintone/dts-gen

Version:

Types for kintone js api and Types generating tools

26 lines 1.12 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.validateArgs = void 0; const validateArgs = (args) => { if (args.baseUrl === null) { throw new Error("--base-url (KINTONE_BASE_URL) must be specified"); } const identifierConventionMsg = `In the ECMA262 specification, this is an invalid string as IdentifierName.`; if (args.namespace && !isValidIdentifier(args.namespace)) { throw new Error(`Invalid namespace option!\n${identifierConventionMsg}`); } if (args.typeName && !isValidIdentifier(args.typeName)) { throw new Error(`Invalid type-name option!\n${identifierConventionMsg}`); } }; exports.validateArgs = validateArgs; /** * https://262.ecma-international.org/14.0/index.html#prod-IdentifierName * @param targetIdentifier */ const isValidIdentifier = (targetIdentifier) => { const identifiers = targetIdentifier.split("."); const identifierRegex = /^[\p{ID_Start}_$][\p{ID_Continue}$\u200C\u200D]*$/u; return identifiers.every((identifier) => identifierRegex.test(identifier)); }; //# sourceMappingURL=args.js.map