[2 認識迪士特之前的生活
您是否曾經嘗試在模板文字中編寫多行段落,但意識到它保留了凹痕,最終使用\ n?
$ bun index.ts
-200好
請求成功了。 “成功”的結果含義取決於HTTP方法:
*獲取:資源已被獲取...
*頭:表示標題是...
*放置或發布:描述...的資源
*跟踪:消息主體包含...
function explain() { const description = ` - 200 OK The request succeeded. The result meaning of "success" depends on the HTTP method: * GET: The resource has been fetched... * HEAD: The representation headers are... * PUT or POST: The resource describing... * TRACE: The message body contains the... ` console.log(description) } explain()
$ bun index.ts - 200 OK The request succeeded. The result meaning of "success" depends on the HTTP method: * GET: The resource has been fetched... * HEAD: The representation headers are... * PUT or POST: The resource describing... * TRACE: The message body contains the...函數dimend(){ const描述=' - 200 ok \ n' '請求成功了。 “成功”的結果含義取決於http方法:\ n \ n' ' *獲取:資源已被獲取... \ n' ' *頭:表示標題為... \ n' ' * put或post:描述... \ n'的資源 ' *跟踪:消息主體包含... \ n' console.log(描述) } 解釋()
出於這個原因,多行文本對我來說總是令人頭疼的。
我會接受。 ?
$ bun index.ts - 200 OK The request succeeded. The result meaning of "success" depends on the HTTP method: * GET: The resource has been fetched... * HEAD: The representation headers are... * PUT or POST: The resource describing... * TRACE: The message body contains the...現在你知道迪士特
,但是現在,您不必再與自己進行談判了。只需使用destent。
從'dedent'導入dettent 函數解釋(){ const描述= dedent` -200好 請求成功了。 “成功”的結果含義取決於HTTP方法: *獲取:資源已被獲取... *頭:表示標題是... *放置或發布:描述...的資源 *跟踪:消息主體包含... ` console.log(描述) } 解釋()
$ bun index.ts
-200好
請求成功了。 “成功”的結果含義取決於HTTP方法:
*獲取:資源已被獲取...
*頭:表示標題是...
*放置或發布:描述...的資源
*跟踪:消息主體包含...
import dedent from 'dedent' function explain() { const description = dedent` - 200 OK The request succeeded. The result meaning of "success" depends on the HTTP method: * GET: The resource has been fetched... * HEAD: The representation headers are... * PUT or POST: The resource describing... * TRACE: The message body contains the... ` console.log(description) } explain()為什麼我們不嘗試更複雜的呢?
$ bun index.ts - 200 OK The request succeeded. The result meaning of "success" depends on the HTTP method: * GET: The resource has been fetched... * HEAD: The representation headers are... * PUT or POST: The resource describing... * TRACE: The message body contains the...$ bun index.ts -200好 請求成功了。 “成功”的結果含義取決於HTTP方法: *獲取:資源已在消息主體中獲取和傳輸。 *頭:表示標題包含在沒有任何消息主體的響應中。 *放置或發布:描述動作結果的資源在消息正文中傳輸。 *跟踪:消息主體包含服務器接收的請求消息。 - 201創建 該請求成功,因此創建了新的資源。 這通常是在發布請求後發送的響應,或某些提出請求。
免責聲明: 提供的所有資源部分來自互聯網,如果有侵犯您的版權或其他權益,請說明詳細緣由並提供版權或權益證明然後發到郵箱:[email protected] 我們會在第一時間內為您處理。
Copyright© 2022 湘ICP备2022001581号-3