You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
589 B
22 lines
589 B
2 years ago
|
"use strict";
|
||
|
|
||
|
var toArray = require("es5-ext/array/to-array")
|
||
|
, isValue = require("es5-ext/object/is-value")
|
||
|
, callable = require("es5-ext/object/valid-callable");
|
||
|
|
||
|
var slice = Array.prototype.slice, resolveArgs;
|
||
|
|
||
|
resolveArgs = function (args) {
|
||
|
return this.map(function (resolve, i) {
|
||
|
return resolve ? resolve(args[i]) : args[i];
|
||
|
}).concat(slice.call(args, this.length));
|
||
|
};
|
||
|
|
||
|
module.exports = function (resolvers) {
|
||
|
resolvers = toArray(resolvers);
|
||
|
resolvers.forEach(function (resolve) {
|
||
|
if (isValue(resolve)) callable(resolve);
|
||
|
});
|
||
|
return resolveArgs.bind(resolvers);
|
||
|
};
|