我有一个如下所示的 JSON。我需要删除 array = ["field", "type", "input"] 中提到的一些键
const result = {
"condition":"AND",
"rules":[
{
"id":"search_across",
"operator":"equal",
"value":1
},
{
"condition":"AND",
"rules":[
{
"id":"Recipe ID",
"field":"Recipe ID",
"type":"string",
"input":"text",
"operator":"equal",
"value":"100"
},
{
"condition":"AND",
"rules":[
{
"id":"Recipe ID",
"field":"Recipe ID",
"type":"string",
"input":"text",
"operator":"equal",
"value":"200"
}
]
}
]
}
]
}
Run Code Online (Sandbox Code Playgroud)
我需要删除第 n 层的钥匙。我只能从第一级删除它(如 JSON 中所示)
我正在尝试使用npm docx
. 我正在尝试从 SQLite 数据库中读取数据,但由于异步节点 js 属性,这些值没有进入变量并显示undefined
. 如果我使函数同步npm docx
则会引发错误并且不会填充文档。
包.json
{
"name": "demoName",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"body-parser": "^1.19.0",
"docx": "^5.1.1",
"express": "^4.17.1",
"md5": "^2.2.1",
"sqlite3": "^4.2.0"
}
}
Run Code Online (Sandbox Code Playgroud)
索引.js
const docx = require('docx');
var express = require('express');
var app = express();
var db = require("./database.js")
var bodyParser = require("body-parser");
app.use(bodyParser.urlencoded({ extended: …
Run Code Online (Sandbox Code Playgroud)