UNPKG

1.24 kBJavaScriptView Raw
1"use strict";
2var __importDefault = (this && this.__importDefault) || function (mod) {
3 return (mod && mod.__esModule) ? mod : { "default": mod };
4};
5Object.defineProperty(exports, "__esModule", { value: true });
6exports.IsBIC = exports.isBIC = exports.IS_BIC = void 0;
7const ValidateBy_1 = require("../common/ValidateBy");
8const isBIC_1 = __importDefault(require("validator/lib/isBIC"));
9exports.IS_BIC = 'isBIC';
10/**
11 * Check if a string is a BIC (Bank Identification Code) or SWIFT code.
12 * If given value is not a string, then it returns false.
13 */
14function isBIC(value) {
15 return typeof value === 'string' && (0, isBIC_1.default)(value);
16}
17exports.isBIC = isBIC;
18/**
19 * Check if a string is a BIC (Bank Identification Code) or SWIFT code.
20 * If given value is not a string, then it returns false.
21 */
22function IsBIC(validationOptions) {
23 return (0, ValidateBy_1.ValidateBy)({
24 name: exports.IS_BIC,
25 validator: {
26 validate: (value, args) => isBIC(value),
27 defaultMessage: (0, ValidateBy_1.buildMessage)(eachPrefix => eachPrefix + '$property must be a BIC or SWIFT code', validationOptions),
28 },
29 }, validationOptions);
30}
31exports.IsBIC = IsBIC;
32//# sourceMappingURL=IsBIC.js.map
\No newline at end of file