efate
Version:
javascript test fixture generator. Autofixturejs 2.0
14 lines (13 loc) • 580 B
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const field_1 = __importDefault(require("../field"));
const pickFromBuilder = (fieldName, [options]) => (increment) => {
if (!options || options.length === 0) {
throw new Error('missing or empty options array');
}
return new field_1.default(fieldName, options[Math.floor(Math.random() * options.length)]);
};
exports.default = pickFromBuilder;