当我运行以下内容时,我得到
$ node t.js
{ "project": { "key": "DEMO" }, "issuetype": { "id": 10002 }, "priority": { "id": "3" }}
{ "project": { "key": "DEMO" }, "issuetype": { "id": 10002 }, "priority": { "id": "3" }}
{ "project": { "key": "DEMO" }, "issuetype": { "id": 10002 }, "priority": { "id": "3" }}
并且time
没有添加键/值。
有人能弄清楚为什么吗?
t.js
const toml = require('./toml');
const moment = require('moment');
const t = toml('non-production.toml');
let a = new Object;
a = t.Jira.pack.c;
console.log(a);
const time = moment().format("YYYY-MM-DDTHH:mm:ss.SSSZZ");
a["customfield_11904"] = time;
a.customfield_11904 = time;
console.log(a);
t.Jira.pack.c.customfield_11904 = time;
console.log(t.Jira.pack.c);
toml.js
const TOML = require('@iarna/toml');
const fs = require('fs');
module.exports = (filename) => {
return TOML.parse(fs.readFileSync(filename, 'utf-8'));
}
非生产.toml
[Jira]
pack.c = '{ "project": { "key": "DEMO" }, "issuetype": { "id": 10002 }, "priority": { "id": "3" }}'