resolve-length.js 363 B

123456789101112131415
  1. "use strict";
  2. var toPosInt = require("es5-ext/number/to-pos-integer");
  3. module.exports = function (optsLength, fnLength, isAsync) {
  4. var length;
  5. if (isNaN(optsLength)) {
  6. length = fnLength;
  7. if (!(length >= 0)) return 1;
  8. if (isAsync && length) return length - 1;
  9. return length;
  10. }
  11. if (optsLength === false) return false;
  12. return toPosInt(optsLength);
  13. };