UNPKG

1.17 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.IsISRC = exports.isISRC = exports.IS_ISRC = void 0;
7const ValidateBy_1 = require("../common/ValidateBy");
8const isISRC_1 = __importDefault(require("validator/lib/isISRC"));
9exports.IS_ISRC = 'isISRC';
10/**
11 * Check if the string is a ISRC.
12 * If given value is not a string, then it returns false.
13 */
14function isISRC(value) {
15 return typeof value === 'string' && (0, isISRC_1.default)(value);
16}
17exports.isISRC = isISRC;
18/**
19 * Check if the string is a ISRC.
20 * If given value is not a string, then it returns false.
21 */
22function IsISRC(validationOptions) {
23 return (0, ValidateBy_1.ValidateBy)({
24 name: exports.IS_ISRC,
25 validator: {
26 validate: (value, args) => isISRC(value),
27 defaultMessage: (0, ValidateBy_1.buildMessage)(eachPrefix => eachPrefix + '$property must be an ISRC', validationOptions),
28 },
29 }, validationOptions);
30}
31exports.IsISRC = IsISRC;
32//# sourceMappingURL=IsISRC.js.map
\No newline at end of file