const binding = process.binding('util');
var Debug;
-var ObjectIsPromise;
const formatRegExp = /%[sdj%]/g;
exports.format = function(f) {
function ensureDebugIsInitialized() {
if (Debug === undefined) {
const runInDebugContext = require('vm').runInDebugContext;
- const result = runInDebugContext('[Debug, ObjectIsPromise]');
- Debug = result[0];
- ObjectIsPromise = result[1];
+ Debug = runInDebugContext('Debug');
}
}
function inspectPromise(p) {
ensureDebugIsInitialized();
- if (!ObjectIsPromise(p))
+ if (!binding.isPromise(p))
return null;
const mirror = Debug.MakeMirror(p, true);
return {status: mirror.status(), value: mirror.promiseValue().value_};
args.GetReturnValue().Set(args[0]->IsSetIterator());
}
+static void IsPromise(const FunctionCallbackInfo<Value>& args) {
+ CHECK_EQ(1, args.Length());
+ args.GetReturnValue().Set(args[0]->IsPromise());
+}
void Initialize(Local<Object> target,
Local<Value> unused,
Environment* env = Environment::GetCurrent(context);
env->SetMethod(target, "isMapIterator", IsMapIterator);
env->SetMethod(target, "isSetIterator", IsSetIterator);
+ env->SetMethod(target, "isPromise", IsPromise);
}
} // namespace util