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