Files
memoizee/lib/resolve-length.js
Mariusz Nowak eb72d16bf6 Major reorganization and partial refactoring
- Move out main modules from `lib` folder
- Introduce `normalizer` based configurations, and convert primitive and regular handlers into thos normalizers (can be found in lib/normalizers folder). Custom normalizers can be provided at run time via `normaizer` option
- Provide `plain` module which does not load any extensions or normalizers. Any extensions that have to be used should be required upfront and normalizers should be provided directly
- Remove `method` option, instead `methods` and `methods-plan` modules are provided which generate descriptors for lazy created memoized methods
- `profile` is no longer extension. To be used it should be required directly
- Improve logic for `async` handling
- Take out `max` extensionLRU logic into external `lru-queue` package
- Remove `context` option
- Remove possibility to access original arguments when resolvers are used
- Assure expected length of memoized functions
2014-04-27 12:11:06 +02:00

16 lines
363 B
JavaScript

'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);
};