2016-10-31 7 views
-1

私はatom/apm codeで、関数の定義、またはパッケージの依存関係の場所を探しています。これは、ライン93coffeescript underlineメソッドはどこから来たのですか?

items.push(repository.underline) 
items.push(pack.description.replace(/\s+/g, ' ')) if pack.description 

src/view.coffeeで呼び出さしかし、そのメソッドがどこから来るか私はわからない、または私はノードREPLで、それを再現することができるだろうかを取得します。それはどこから来たのですか?

答えて

1

repository.underlineは方法ではありません(かっこはありません)。repository変数のプロパティです。

repository variableは、pack.repository.url or pack.repositoryです。

pack is populated from a JSON HTTP API responserepositorymetadataで、JSONはversions[version]です。 versiongetLatestCompatibleVersionで決定されます。

sample response for the minimap packageを使用すると、特定のバージョンのすべてのrepositoryの値がプレーンストリングであるように見えるので、.underlineプロパティはそのオブジェクトから取得されません。彼らは普通の文字列なので、何かがおそらくunderlineプロパティを含むようにjavascript Stringプロトタイプを拡張しましたが、何ですか?

sample searchからは、.underlineが端末タイプの出力に使用されているようです。 package.json dependencies, the colors package works in that spaceを見てください。

colorsadds a number of properties to the string prototypeunderlineを含む)。

これは、プロトタイプの拡張が混乱する可能性のある良い例です。

関連する問題