UNPKG

tar

Version:
25 lines • 954 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.countOption = exports.ownOptions = void 0; /** * A copy of the options with no prototype, so that an option that is * not set cannot get a value from a changed `Object.prototype`. */ const ownOptions = (opt, more) => Object.assign(Object.create(null), opt, more); exports.ownOptions = ownOptions; /** * The value of an option that is a count, such as `jobs`: the * default if the option is not set or is 0, and a `TypeError` if the * value is not a positive integer or `Infinity`. */ const countOption = (name, value, def) => { if (value === undefined || value === null || value === 0) return def; if (value === Infinity || (Number.isInteger(value) && Number(value) > 0)) { return value; } throw new TypeError(`${name} must be a positive integer`); }; exports.countOption = countOption; //# sourceMappingURL=options.js.map