smh-ajv-utils
Version:
AJV additional Keywords and Formats
12 lines (11 loc) • 372 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const positiveNumberInStringFormat = {
type: 'string',
validate: (data) => {
const number = typeof data === 'string' ? parseFloat(data) : data;
const result = !isNaN(number) && number >= 0;
return result;
},
};
exports.default = positiveNumberInStringFormat;