在Bluebird的util.js文件中,它具有以下功能:
function toFastProperties(obj) {
/*jshint -W027*/
function f() {}
f.prototype = obj;
ASSERT("%HasFastProperties", true, obj);
return f;
eval(obj);
}
Run Code Online (Sandbox Code Playgroud)
出于某种原因,在返回函数之后有一个声明,我不知道它为什么存在.
同样,它似乎是故意的,因为作者已经沉默了JSHint对此的警告:
'return'后无法访问'eval'.(W027)
这个功能到底是做什么的?难道util.toFastProperties真的让一个对象的属性"快"?
我在Bluebird的GitHub存储库中搜索了源代码中的任何注释或者问题列表中的解释,但我找不到任何注释.