配列様って何?
久しくプログラミングから離れている。
勉強しようと思ったら
MDNの https://developer.mozilla.org/ja/docs/Web/JavaScript/Guide/Indexed_collections#Working_with_array-like_objects に
「配列様のオブジェクトを利用する」とある!
配列はとくに別格で「様」を付けるのだろうか?
誤植だよね
恐れ多くて報告もひかえようっと。
memo
ローカルファイルに書き込む
{ const DEFAULT_OPTIION = { type: 'text/csv', ending: 'transparent' //or 'native' }, DEFAULT_STATE = { open: false, auto_type: true }, BOM = new Uint8Array ([0xEF, 0xBB, 0xBF]), HASH_TYPE = { csv: 'text/csv', html: 'text/html', txt: 'text/plane' }; //__ function main (fileName = null, str = '', argOption = {}, argState = { } ) { if (! fileName) throw new Error ('ファイル名が無効'); let content = [ ]; option = Object.assign ({ }, DEFAULT_OPTIION, argOption), state = Object.assign ({ }, DEFAULT_STATE, argState); if (state.auto_type) { let rst_ = /\.(csv|html|txt)$/.exec (fileName); if (rst_) { let ext = rst_[1]; option.type = HASH_TYPE[ext]; if ('csv' === ext) content.push (BOM); } } content.push (str); let blob = new Blob (content, option); let navi = window.navigator.msSaveBlob; (navi) ? (state.open) ? navi.msSaveOrOpenBlob (blob, fileName) : navi.msSaveBlob (blob, fileName) : location.href = window.URL.createObjectURL(blob); } //__ this.saveToLocalFile = main; } //document.getElementById("download").download = "temp.txt"; //saveToLocalFile ('testq.html', '<body></body>');