123456789101112131415161718192021222324 |
- "use strict";
- Object.defineProperty(exports, "__esModule", { value: true });
- exports.wrap = function (input) {
- return typeof input !== 'string' || input.length === 1
- ? input.toString()
- : "(?:" + input + ")";
- };
- exports.concat = function () {
- var inputs = [];
- for (var _i = 0; _i < arguments.length; _i++) {
- inputs[_i] = arguments[_i];
- }
- return inputs.join('');
- };
- exports.optional = function (input) { return exports.wrap(input) + "?"; };
- exports.repeat = function (input, count, max) {
- return max === undefined
- ? exports.wrap(input) + "{" + count + "}"
- : max === Infinity
- ? count > 1
- ? exports.wrap(input) + "{" + count + ",}"
- : count < 1 ? exports.wrap(input) + "*" : exports.wrap(input) + "+"
- : exports.wrap(input) + "{" + count + "," + max + "}";
- };
|