第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

Zapier Javascript:意外令牌]-在IDE,Repl.it和Node v6.3.1

Zapier Javascript:意外令牌]-在IDE,Repl.it和Node v6.3.1

開滿天機 2021-05-04 17:38:37
解決方案:const pattern = /\](,)\s{2,}?/gmlet res = inputData.rows.replace(pattern, (match, group1, offset, string) => "]")            .split(/\s{2,}/gm)            .map(x => JSON.parse(x));res = res[0];   //reassign to scrape an array layerlet resultString = '';for (let i = 0; i < res[0].length; i += 1) {  let cv = res[0][i];  if (cv.length === 0) resultString += `    ${res[1][i]}: ${inputData.rows[2][i]}\n`  else resultString += `${cv}\n    ${res[1][i]}: ${res[2][i]}\n`;}output = {KPI: resultString};問題在Zapier Zap中,我正在從Google表格中提取數(shù)據(jù),并使用JS進行美化,以便稍后發(fā)送電子郵件。我碰到了以下錯誤消息:SyntaxError: Unexpected token ]  stringOfArraysToArrayOfArrays (eval at <anonymous> (/var/task/index.js:52:23), <anonymous>:22:52)  theFunction (eval at <anonymous> (/var/task/index.js:52:23), <anonymous>:29:18)  eval (eval at <anonymous> (/var/task/index.js:52:23), <anonymous>:51:20)  Domain.<anonymous> (/var/task/index.js:53:5)  Domain.run (domain.js:242:14)  module.exports.handler (/var/task/index.js:51:5)我嘗試過的我已成功在不同環(huán)境中(從本地IDE,Repl.It IDE和設(shè)置為Node v6.3.1的在線IDE)將最新版本的Node的代碼運行回Node v6.3.1。他們都清楚了。我還嘗試清除所有ES6 +語法的代碼(沒有示例數(shù)據(jù))數(shù)據(jù)示例let inputData = {  rows: `["Prioritized Tasks", "", "", "", "Operational Tasks", "", "", "", "Eight Dimensions", "", "", "", "", "", "", "", "Burn-Out", "", "", "", "", "", "", "", "", "", "Violations"], }
查看完整描述

1 回答

?
犯罪嫌疑人X

TA貢獻2080條經(jīng)驗 獲得超4個贊

這種方法可能有點實用。


您需要首先將],每行中的替換為一個空字符串,我已使用此Regex對其進行了拆分。


之后,我將字符串分割成兩個以上字符的空格。


然后,最后我習(xí)慣.map了在拆分后的項目上進行投影,以將其解析回并組成一個數(shù)組數(shù)組。


const inputData = {

  rows: `["Prioritized Tasks", "", "", "", "Operational Tasks", "", "", "", "Eight Dimensions", "", "", "", "", "", "", "", "Burn-Out", "", "", "", "", "", "", "", "", "", "Violations"], 

    ["Completion Rate", "Avg Completed", "Avg Total Scheduled", "Avg Time Spent", "Completion Rate", "Avg Completed", "Avg Total Scheduled", "Avg Time Spent", "Emotional", "Environmental", "Financial", "Intellectual", "Occupational", "Physical", "Social", "Spiritual", "Feeling Stressed", "Feeling Depleted", "Having Trouble Concentrating", "Feeling Forgetful", "Wanting to avoid social situations", "Feeling pessimistic", "Feeling cynical", "Feeling apathetic or disinterested", "Not feeling engaged with my work", "My overall energy level", "Temperance", "Silence", "Order", "Resolution", "Frugality", "Industry", "Sincerity", "Justice", "Moderation", "Cleanliness", "Tranquility", "Chastity", "Humility"], 

    ["70.33", "4", "6.67", "380", "3.67", "3.67", "66.67", "100", "8", "5.33", "5.67", "4.67", "4", "5", "4.67", "6.67", "1.33", "4", "5", "4.67", "3.33", "3.33", "1.33", "5", "6", "5.67", "0.3333333333", "0.3333333333", "0.3333333333", "0", "1", "0", "0", "0", "0", "0.3333333333", "0.3333333333", "0.3333333333", "0.3333333333"]`

};


const pattern = /\](,)\s{2,}?/gm

const res = inputData.rows.replace(pattern, (match, group1, offset, string) => "]")

            .split(/\s{2,}/gm)

            .map(x => JSON.parse(x));


const output = { KPI: res };


console.log(output);


查看完整回答
反對 回復(fù) 2021-05-27
  • 1 回答
  • 0 關(guān)注
  • 110 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號