質問編集履歴
3
脱字
test
CHANGED
File without changes
|
test
CHANGED
@@ -18,7 +18,7 @@
|
|
18
18
|
|
19
19
|
const columns = ["ttl","eisbn","url"];
|
20
20
|
|
21
|
-
.map((c) => column.indexOf(c)); //resのcolumnからttl,eisbn,urlの要素番号を取得
|
21
|
+
.map((c) => res.column.indexOf(c)); //resのcolumnからttl,eisbn,urlの要素番号を取得
|
22
22
|
|
23
23
|
for (const item of res.list) {
|
24
24
|
|
2
情報修正、加筆
test
CHANGED
File without changes
|
test
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
これを解決するためにはどのようにしたらよいでしょうか。
|
4
4
|
|
5
|
-
res.listにはt
|
5
|
+
res.listにはttl,eisbn,url以外にも要素が含まれており、この3つだけ抽出し新たなオブジェクトにしたいです。
|
6
6
|
|
7
7
|
|
8
8
|
|
@@ -14,7 +14,11 @@
|
|
14
14
|
|
15
15
|
```ここに言語を入力
|
16
16
|
|
17
|
+
const parsedItems = [];
|
18
|
+
|
17
|
-
const columns = ["t
|
19
|
+
const columns = ["ttl","eisbn","url"];
|
20
|
+
|
21
|
+
.map((c) => column.indexOf(c)); //resのcolumnからttl,eisbn,urlの要素番号を取得
|
18
22
|
|
19
23
|
for (const item of res.list) {
|
20
24
|
|
@@ -22,9 +26,41 @@
|
|
22
26
|
|
23
27
|
columns.forEach((c) => {
|
24
28
|
|
29
|
+
//colunmsに格納されたttl,eisbn,urlの要素番号を指定してこの3つだけ取得
|
30
|
+
|
25
31
|
newItem[columns[c]] = item[c]; //ここでエラー
|
26
32
|
|
27
33
|
});
|
34
|
+
|
35
|
+
parsedItems.push(newItem);
|
36
|
+
|
37
|
+
```
|
38
|
+
|
39
|
+
response.json(一部分)
|
40
|
+
|
41
|
+
```
|
42
|
+
|
43
|
+
{
|
44
|
+
|
45
|
+
|
46
|
+
|
47
|
+
"column":["id","url","img","eisbn","date","ttl","ttl_kana","athr","dprc","bprc","ahid_id","jun_id","cpn_id","ser_id","lbl_id","s_rec","s_new","s_res","s_frc","f_adlt","fc1_id","fc2_id","fc3_id","viewer_id","viewer_url"],
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
"list":[
|
52
|
+
|
53
|
+
[1,16749340,"non",9784047366572,0,"浅草鬼嫁日記 あやかし夫婦は今世こそ幸せになりたい。 6","non","藤丸豆ノ介",-1,0,"B's-LOG COMICS",1,0,10000,1000,0,0,0,0,0,"7月1日",0,1,1,"http://search.books.rakuten.co.jp/bksearch/dt/g001/bathr%C6%A3%B4%DD%C6%A6%A5%CE%B2%F0/?s=2"],
|
54
|
+
|
55
|
+
[2,16749316,"non",9784047366763,0,"虐げられし令嬢は、世界樹の主になりました 1","non","永倉 早",-1,0,"B's-LOG COMICS",1,0,10000,1000,0,0,0,0,0,"7月1日",0,1,1,"http://search.books.rakuten.co.jp/bksearch/dt/g001/bathr%B1%CA%C1%D2%A1%A1%C1%E1/?s=2"],
|
56
|
+
|
57
|
+
[3,16749314,"non",9784047366770,0,"地味で目立たない私は、今日で終わりにします。 3","non","住吉 文子",-1,0,"B's-LOG COMICS",1,0,10000,1000,0,0,0,0,0,"7月1日",0,1,1,"http://search.books.rakuten.co.jp/bksearch/dt/g001/bathr%BD%BB%B5%C8%A1%A1%CA%B8%BB%D2/?s=2"],
|
58
|
+
|
59
|
+
[4,16749313,"non",9784047366787,0,"薬師の伯爵令嬢は伝説の仔竜に愛される 2","non","Luna.M",-1,0,"B's-LOG COMICS",1,0,10000,1000,0,0,0,0,0,"7月1日",0,1,1,"http://search.books.rakuten.co.jp/bksearch/dt/g001/bathr%4C%75%6E%61%2E%4D/?s=2"],
|
60
|
+
|
61
|
+
[5,16749318,"non",9784047366794,0,"妹に婚約者を譲れと言われました 最強の竜に気に入られてまさかの王国乗っ取り? 4","non","hi8mugi",-1,0,"B's-LOG COMICS",1,0,10000,1000,0,0,0,0,0,"7月1日",0,1,1,"http://search.books.rakuten.co.jp/bksearch/dt/g001/bathr%68%69%38%6D%75%67%69/?s=2"],
|
62
|
+
|
63
|
+
以下略
|
28
64
|
|
29
65
|
```
|
30
66
|
|
1
タイトル変更
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
typescriptにて
|
1
|
+
typescriptにてオブジェクトのインデックス指定ができない
|
test
CHANGED
File without changes
|