Opal-Estate-Pro/node_modules/memoizee/lib/resolve-length.js

16 lines
363 B
JavaScript
Raw Normal View History

2019-09-13 06:27:52 +02:00
"use strict";
var toPosInt = require("es5-ext/number/to-pos-integer");
module.exports = function (optsLength, fnLength, isAsync) {
var length;
if (isNaN(optsLength)) {
length = fnLength;
if (!(length >= 0)) return 1;
if (isAsync && length) return length - 1;
return length;
}
if (optsLength === false) return false;
return toPosInt(optsLength);
};