UNPKG

@whisklabs/grpc

Version:

gRPC generator and http library for typescript

29 lines 1.09 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.isProto = exports.isNumber = exports.isText = exports.isStr = void 0; var tokenizer_1 = require("./tokenizer"); var utils_1 = require("./utils"); function isStr(str) { return isText(str) ? (str.slice(0, 1) === '"' && str.slice(-1) === '"') || (str.slice(0, 1) === "'" && str.slice(-1) === "'") : false; } exports.isStr = isStr; isStr.toString = function () { return ' string with quotes "..." or \'...\' '; }; function isText(str) { return typeof str === 'string' && !tokenizer_1.SYMBOLS[str]; } exports.isText = isText; isText.toString = function () { return 'string'; }; function isNumber(str) { return !isNaN(Number(str)); } exports.isNumber = isNumber; isNumber.toString = function () { return 'number'; }; function isProto(str) { var s = (0, utils_1.cutStr)(str); return s === 'proto2' || s === 'proto3'; } exports.isProto = isProto; isProto.toString = function () { return ' string with quotes "proto2" or "proto3" '; }; //# sourceMappingURL=validators.js.map