ファイル:セーフストリング
// Build out our basic SafeString type
function SafeString(string) {
this.string = string;
}
SafeString.prototype.toString = function() {
return "" + this.string;
};
export default SafeString;
今まで見たことがありません。もっと簡単に理解できるexport default
同等のものはありますか?export default
ベストアンサー1
これはES6モジュールシステムの一部であり、ここで説明このドキュメントには役立つ例も記載されています:
モジュールがデフォルトのエクスポートを定義する場合:
// foo.js export default function() { console.log("hello!") }
中括弧を省略すると、デフォルトのエクスポートをインポートできます。
import foo from "foo"; foo(); // hello!
更新: 2015年6月現在、モジュールシステムは次のように定義されています。§15.2特に構文export
は次のように定義されています。§15.2.3ECMAScript 2015 仕様の。