私は最近、1 つの V8 コンテキストでリテラル正規表現構文を使用すると、コンテキスト間でグローバル オブジェクトを共有している場合でも が false を返すことを発見しました。instanceof RegExp
RegExp
var Contextify = require('contextify');
var ctx = Contextify({ RegExp:RegExp, app: anExpressApp });
// When you create a new route, Express checks if the argument is an
// `instanceof RegExp`, and assumes it is a string if not.
ctx.run("
app.get(new RegExp('...'), function() { ... }); // works because we share the `RegExp` global between contexts
app.get(/.../, function() { ... }); // does not work
");
オブジェクトがRegExp
クロスコンテキストかどうかを確実に確認するにはどうすればよいですか?