This repository has been archived on 2024-07-27. You can view files and clone it, but cannot push or open issues or pull requests.
keksAccountGUI/node_modulesOLD/enhanced-resolve/lib/createInnerCallback.js
2019-08-11 20:48:02 +02:00

47 lines
1.2 KiB
JavaScript

/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const util = require("util");
// TODO remove in enhanced-resolve 5
module.exports = util.deprecate(function createInnerCallback(callback, options, message, messageOptional) {
const log = options.log;
if(!log) {
if(options.stack !== callback.stack) {
const callbackWrapper = function callbackWrapper() {
return callback.apply(this, arguments);
};
callbackWrapper.stack = options.stack;
callbackWrapper.missing = options.missing;
return callbackWrapper;
}
return callback;
}
function loggingCallbackWrapper() {
return callback.apply(this, arguments);
}
if(message) {
if(!messageOptional) {
log(message);
}
loggingCallbackWrapper.log = function writeLog(msg) {
if(messageOptional) {
log(message);
messageOptional = false;
}
log(" " + msg);
};
} else {
loggingCallbackWrapper.log = function writeLog(msg) {
log(msg);
};
}
loggingCallbackWrapper.stack = options.stack;
loggingCallbackWrapper.missing = options.missing;
return loggingCallbackWrapper;
}, "Pass resolveContext instead and use createInnerContext");