@sasjs/utils 2.43.0 → 2.44.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/input/index.d.ts +1 -0
- package/input/index.js +3 -1
- package/input/index.js.map +1 -1
- package/input/validators.d.ts +1 -0
- package/input/validators.js +11 -1
- package/input/validators.js.map +1 -1
- package/package.json +1 -1
package/input/index.d.ts
CHANGED
package/input/index.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getUrl = exports.getConfirmation = exports.getChoice = exports.getNumber = exports.getString = void 0;
|
|
3
|
+
exports.isSpecialMissing = exports.getUrl = exports.getConfirmation = exports.getChoice = exports.getNumber = exports.getString = void 0;
|
|
4
4
|
var readAndValidateInput_1 = require("./readAndValidateInput");
|
|
5
5
|
Object.defineProperty(exports, "getString", { enumerable: true, get: function () { return readAndValidateInput_1.getString; } });
|
|
6
6
|
Object.defineProperty(exports, "getNumber", { enumerable: true, get: function () { return readAndValidateInput_1.getNumber; } });
|
|
7
7
|
Object.defineProperty(exports, "getChoice", { enumerable: true, get: function () { return readAndValidateInput_1.getChoice; } });
|
|
8
8
|
Object.defineProperty(exports, "getConfirmation", { enumerable: true, get: function () { return readAndValidateInput_1.getConfirmation; } });
|
|
9
9
|
Object.defineProperty(exports, "getUrl", { enumerable: true, get: function () { return readAndValidateInput_1.getUrl; } });
|
|
10
|
+
var validators_1 = require("./validators");
|
|
11
|
+
Object.defineProperty(exports, "isSpecialMissing", { enumerable: true, get: function () { return validators_1.isSpecialMissing; } });
|
|
10
12
|
//# sourceMappingURL=index.js.map
|
package/input/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/input/index.ts"],"names":[],"mappings":";;;AAAA,+DAS+B;AAR7B,iHAAA,SAAS,OAAA;AACT,iHAAA,SAAS,OAAA;AACT,iHAAA,SAAS,OAAA;AACT,uHAAA,eAAe,OAAA;AACf,8GAAA,MAAM,OAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/input/index.ts"],"names":[],"mappings":";;;AAAA,+DAS+B;AAR7B,iHAAA,SAAS,OAAA;AACT,iHAAA,SAAS,OAAA;AACT,iHAAA,SAAS,OAAA;AACT,uHAAA,eAAe,OAAA;AACf,8GAAA,MAAM,OAAA;AAMR,2CAA+C;AAAtC,8GAAA,gBAAgB,OAAA"}
|
package/input/validators.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export declare const urlValidator: (value: string, errorMessage: string) => string | true;
|
|
2
2
|
export declare const confirmationValidator: (value: any) => boolean;
|
|
3
3
|
export declare const choiceValidator: (value: number, numberOfChoices: number, errorMessage: string) => string | true;
|
|
4
|
+
export declare const isSpecialMissing: (value: any) => boolean;
|
package/input/validators.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.choiceValidator = exports.confirmationValidator = exports.urlValidator = void 0;
|
|
6
|
+
exports.isSpecialMissing = exports.choiceValidator = exports.confirmationValidator = exports.urlValidator = void 0;
|
|
7
7
|
var valid_url_1 = __importDefault(require("valid-url"));
|
|
8
8
|
var urlValidator = function (value, errorMessage) {
|
|
9
9
|
return !!valid_url_1.default.isHttpUri(value) ||
|
|
@@ -18,4 +18,14 @@ var confirmationValidator = function (value) {
|
|
|
18
18
|
exports.confirmationValidator = confirmationValidator;
|
|
19
19
|
var choiceValidator = function (value, numberOfChoices, errorMessage) { return (value > 0 && value <= numberOfChoices) || errorMessage; };
|
|
20
20
|
exports.choiceValidator = choiceValidator;
|
|
21
|
+
// This regex will match special missing
|
|
22
|
+
// `a-z` or `_` or `.` or '.[a-z]'
|
|
23
|
+
var isSpecialMissing = function (value) {
|
|
24
|
+
// This regex can't cover the case with `..` two dots, so if we receive it that is false special missing
|
|
25
|
+
if (typeof value === 'string' && value.includes('..'))
|
|
26
|
+
return false;
|
|
27
|
+
var regex = new RegExp('^(\\.)?[a-z_.]{1}$', 'i');
|
|
28
|
+
return regex.test(value);
|
|
29
|
+
};
|
|
30
|
+
exports.isSpecialMissing = isSpecialMissing;
|
|
21
31
|
//# sourceMappingURL=validators.js.map
|
package/input/validators.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validators.js","sourceRoot":"","sources":["../../src/input/validators.ts"],"names":[],"mappings":";;;;;;AAAA,wDAAgC;AAEzB,IAAM,YAAY,GAAG,UAAC,KAAa,EAAE,YAAoB;IAC9D,OAAA,CAAC,CAAC,mBAAQ,CAAC,SAAS,CAAC,KAAK,CAAC;QAC3B,CAAC,CAAC,mBAAQ,CAAC,UAAU,CAAC,KAAK,CAAC;QAC5B,KAAK,KAAK,EAAE;QACZ,YAAY;AAHZ,CAGY,CAAA;AAJD,QAAA,YAAY,gBAIX;AAEP,IAAM,qBAAqB,GAAG,UAAC,KAAU;IAC9C,OAAA,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,KAAK;AAAjC,CAAiC,CAAA;AADtB,QAAA,qBAAqB,yBACC;AAE5B,IAAM,eAAe,GAAG,UAC7B,KAAa,EACb,eAAuB,EACvB,YAAoB,IACjB,OAAA,CAAC,KAAK,GAAG,CAAC,IAAI,KAAK,IAAI,eAAe,CAAC,IAAI,YAAY,EAAvD,CAAuD,CAAA;AAJ/C,QAAA,eAAe,mBAIgC"}
|
|
1
|
+
{"version":3,"file":"validators.js","sourceRoot":"","sources":["../../src/input/validators.ts"],"names":[],"mappings":";;;;;;AAAA,wDAAgC;AAEzB,IAAM,YAAY,GAAG,UAAC,KAAa,EAAE,YAAoB;IAC9D,OAAA,CAAC,CAAC,mBAAQ,CAAC,SAAS,CAAC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