diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/browser.js | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/browser.js b/lib/browser.js index a7f0039..bd34c13 100644 --- a/lib/browser.js +++ b/lib/browser.js @@ -7,11 +7,15 @@ exports.readFileInputOnChange = readFileInputOnChange; exports.standardOptions = mammoth.standardOptions; exports.htmlPaths = mammoth.htmlPaths; -exports.convertDocumentToHtml = function() { - var args = Array.slice(arguments, 0, arguments.length - 1); - var callback = arguments[arguments.length - 1]; - satisfyCallback(mammoth.convertDocumentToHtml.apply(this, arguments), callback); -}; +exports.convertDocumentToHtml = callbackify(mammoth.convertDocumentToHtml); + +function callbackify(func) { + return function() { + var args = Array.prototype.slice.call(arguments, 0, arguments.length - 1); + var callback = arguments[arguments.length - 1]; + satisfyCallback(func.apply(this, args), callback); + }; +} function readFileInputOnChange(inputElement, callback) { function handleFileSelect(event) { |
