zurvan
Version:
A library for simulating time in Node.js
19 lines (16 loc) • 436 B
JavaScript
;
function exportFunction(exportedObject, functionName) {
return function() {
return exportedObject[functionName].apply(
exportedObject,
[].splice.call(arguments, 0)
);
};
}
function createAPI(exportedObject, functionNames) {
return functionNames.reduce(function(api, name) {
api[name] = exportFunction(exportedObject, name);
return api;
}, {});
}
module.exports.createAPI = createAPI;