MCPcopy Create free account
hub / github.com/Moli-X/Resources / index_handle

Function index_handle

Script/Parser.js:744–759  ·  view source on GitHub ↗
(item)

Source from the content-addressed store, hash-verified

742
743// 节点序号占位符处理
744function index_handle(item) {
745 items = item.map(item=>item.trim()).filter(Boolean)
746 let b=Array.from(new Array(items.length),(val,index)=>index+1);
747 //console.log(b[0])
748 for (var i=0; i< items.length;i++){
749 //$notify("rename"+i,Prname,items[i])
750 if (items[i].indexOf("node_index_prefix") != -1) { // 以免占位符被错误地replace
751 ind = items[i].split("node_index_prefix")[1][0]
752 ind = !/^(0|1|2|3|4|5|6|7|8)$/.test(ind) ? 0 : ind
753 console.log("handle index"+ind)
754 items[i] = items[i].replace(/node_index_prefix(\d{0,1})/g,PatternN((i+1).toString(),"",ind))
755 }
756 }
757 console.log(items)
758 return items
759}
760
761
762// 操作emoji占位符

Callers 1

ResourceParseFunction · 0.85

Calls 5

PatternNFunction · 0.85
fromMethod · 0.45
indexOfMethod · 0.45
logMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected