jsgantt-improved
Advanced tools
Comparing version 2.4.2 to 2.4.3
@@ -39,117 +39,115 @@ "use strict"; | ||
exports.parseJSONString = function (pStr, pGanttVar) { | ||
exports.addJSONTask(pGanttVar, eval('(' + pStr + ')')); | ||
exports.addJSONTask(pGanttVar, JSON.parse(pStr)); | ||
}; | ||
exports.addJSONTask = function (pGanttVar, pJsonObj) { | ||
if ({}.toString.call(pJsonObj) === '[object Array]') { | ||
for (var index = 0; index < pJsonObj.length; index++) { | ||
var id = void 0; | ||
var name_1 = void 0; | ||
var start = void 0; | ||
var end = void 0; | ||
var planstart = void 0; | ||
var planend = void 0; | ||
var itemClass = void 0; | ||
var link = ''; | ||
var milestone = 0; | ||
var resourceName = ''; | ||
var completion = void 0; | ||
var group = 0; | ||
var parent_1 = void 0; | ||
var open_1 = void 0; | ||
var dependsOn = ''; | ||
var caption = ''; | ||
var notes = ''; | ||
var cost = void 0; | ||
var duration = ''; | ||
var additionalObject = {}; | ||
for (var prop in pJsonObj[index]) { | ||
var property = prop; | ||
var value = pJsonObj[index][property]; | ||
switch (property.toLowerCase()) { | ||
case 'pid': | ||
case 'id': | ||
id = value; | ||
break; | ||
case 'pname': | ||
case 'name': | ||
name_1 = value; | ||
break; | ||
case 'pstart': | ||
case 'start': | ||
start = value; | ||
break; | ||
case 'pend': | ||
case 'end': | ||
end = value; | ||
break; | ||
case 'pplanstart': | ||
case 'planstart': | ||
planstart = value; | ||
break; | ||
case 'pplanend': | ||
case 'planend': | ||
planend = value; | ||
break; | ||
case 'pclass': | ||
case 'class': | ||
itemClass = value; | ||
break; | ||
case 'plink': | ||
case 'link': | ||
link = value; | ||
break; | ||
case 'pmile': | ||
case 'mile': | ||
milestone = value; | ||
break; | ||
case 'pres': | ||
case 'res': | ||
resourceName = value; | ||
break; | ||
case 'pcomp': | ||
case 'comp': | ||
completion = value; | ||
break; | ||
case 'pgroup': | ||
case 'group': | ||
group = value; | ||
break; | ||
case 'pparent': | ||
case 'parent': | ||
parent_1 = value; | ||
break; | ||
case 'popen': | ||
case 'open': | ||
open_1 = value; | ||
break; | ||
case 'pdepend': | ||
case 'depend': | ||
dependsOn = value; | ||
break; | ||
case 'pcaption': | ||
case 'caption': | ||
caption = value; | ||
break; | ||
case 'pnotes': | ||
case 'notes': | ||
notes = value; | ||
break; | ||
case 'pcost': | ||
case 'cost': | ||
cost = value; | ||
break; | ||
case 'duration': | ||
case 'pduration': | ||
duration = value; | ||
break; | ||
default: | ||
additionalObject[property.toLowerCase()] = value; | ||
} | ||
for (var index = 0; index < pJsonObj.length; index++) { | ||
var id = void 0; | ||
var name_1 = void 0; | ||
var start = void 0; | ||
var end = void 0; | ||
var planstart = void 0; | ||
var planend = void 0; | ||
var itemClass = void 0; | ||
var link = ''; | ||
var milestone = 0; | ||
var resourceName = ''; | ||
var completion = void 0; | ||
var group = 0; | ||
var parent_1 = void 0; | ||
var open_1 = void 0; | ||
var dependsOn = ''; | ||
var caption = ''; | ||
var notes = ''; | ||
var cost = void 0; | ||
var duration = ''; | ||
var additionalObject = {}; | ||
for (var prop in pJsonObj[index]) { | ||
var property = prop; | ||
var value = pJsonObj[index][property]; | ||
switch (property.toLowerCase()) { | ||
case 'pid': | ||
case 'id': | ||
id = value; | ||
break; | ||
case 'pname': | ||
case 'name': | ||
name_1 = value; | ||
break; | ||
case 'pstart': | ||
case 'start': | ||
start = value; | ||
break; | ||
case 'pend': | ||
case 'end': | ||
end = value; | ||
break; | ||
case 'pplanstart': | ||
case 'planstart': | ||
planstart = value; | ||
break; | ||
case 'pplanend': | ||
case 'planend': | ||
planend = value; | ||
break; | ||
case 'pclass': | ||
case 'class': | ||
itemClass = value; | ||
break; | ||
case 'plink': | ||
case 'link': | ||
link = value; | ||
break; | ||
case 'pmile': | ||
case 'mile': | ||
milestone = value; | ||
break; | ||
case 'pres': | ||
case 'res': | ||
resourceName = value; | ||
break; | ||
case 'pcomp': | ||
case 'comp': | ||
completion = value; | ||
break; | ||
case 'pgroup': | ||
case 'group': | ||
group = value; | ||
break; | ||
case 'pparent': | ||
case 'parent': | ||
parent_1 = value; | ||
break; | ||
case 'popen': | ||
case 'open': | ||
open_1 = value; | ||
break; | ||
case 'pdepend': | ||
case 'depend': | ||
dependsOn = value; | ||
break; | ||
case 'pcaption': | ||
case 'caption': | ||
caption = value; | ||
break; | ||
case 'pnotes': | ||
case 'notes': | ||
notes = value; | ||
break; | ||
case 'pcost': | ||
case 'cost': | ||
cost = value; | ||
break; | ||
case 'duration': | ||
case 'pduration': | ||
duration = value; | ||
break; | ||
default: | ||
additionalObject[property.toLowerCase()] = value; | ||
} | ||
//if (id != undefined && !isNaN(parseInt(id)) && isFinite(id) && name && start && end && itemClass && completion != undefined && !isNaN(parseFloat(completion)) && isFinite(completion) && !isNaN(parseInt(parent)) && isFinite(parent)) { | ||
pGanttVar.AddTaskItem(new task_1.TaskItem(id, name_1, start, end, itemClass, link, milestone, resourceName, completion, group, parent_1, open_1, dependsOn, caption, notes, pGanttVar, cost, planstart, planend, duration, additionalObject)); | ||
//} | ||
} | ||
//if (id != undefined && !isNaN(parseInt(id)) && isFinite(id) && name && start && end && itemClass && completion != undefined && !isNaN(parseFloat(completion)) && isFinite(completion) && !isNaN(parseInt(parent)) && isFinite(parent)) { | ||
pGanttVar.AddTaskItem(new task_1.TaskItem(id, name_1, start, end, itemClass, link, milestone, resourceName, completion, group, parent_1, open_1, dependsOn, caption, notes, pGanttVar, cost, planstart, planend, duration, additionalObject)); | ||
//} | ||
} | ||
}; | ||
//# sourceMappingURL=json.js.map |
{ | ||
"name": "jsgantt-improved", | ||
"version": "2.4.2", | ||
"version": "2.4.3", | ||
"description": "jsgantt-improved", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
222
src/json.ts
@@ -17,3 +17,3 @@ import { TaskItem } from "./task"; | ||
xhttp.send(null); | ||
let bd; | ||
@@ -40,119 +40,117 @@ if (vDebug) { | ||
export const parseJSONString = function (pStr, pGanttVar) { | ||
addJSONTask(pGanttVar, eval('(' + pStr + ')')); | ||
addJSONTask(pGanttVar, JSON.parse(pStr)); | ||
}; | ||
export const addJSONTask = function (pGanttVar, pJsonObj) { | ||
if ({}.toString.call(pJsonObj) === '[object Array]') { | ||
for (let index = 0; index < pJsonObj.length; index++) { | ||
let id; | ||
let name; | ||
let start; | ||
let end; | ||
let planstart; | ||
let planend; | ||
let itemClass; | ||
let link = ''; | ||
let milestone = 0; | ||
let resourceName = ''; | ||
let completion; | ||
let group = 0; | ||
let parent; | ||
let open; | ||
let dependsOn = ''; | ||
let caption = ''; | ||
let notes = ''; | ||
let cost; | ||
let duration =''; | ||
const additionalObject = {}; | ||
for (let index = 0; index < pJsonObj.length; index++) { | ||
let id; | ||
let name; | ||
let start; | ||
let end; | ||
let planstart; | ||
let planend; | ||
let itemClass; | ||
let link = ''; | ||
let milestone = 0; | ||
let resourceName = ''; | ||
let completion; | ||
let group = 0; | ||
let parent; | ||
let open; | ||
let dependsOn = ''; | ||
let caption = ''; | ||
let notes = ''; | ||
let cost; | ||
let duration = ''; | ||
const additionalObject = {}; | ||
for (let prop in pJsonObj[index]) { | ||
let property = prop; | ||
let value = pJsonObj[index][property]; | ||
switch (property.toLowerCase()) { | ||
case 'pid': | ||
case 'id': | ||
id = value; | ||
break; | ||
case 'pname': | ||
case 'name': | ||
name = value; | ||
break; | ||
case 'pstart': | ||
case 'start': | ||
start = value; | ||
break; | ||
case 'pend': | ||
case 'end': | ||
end = value; | ||
break; | ||
case 'pplanstart': | ||
case 'planstart': | ||
planstart = value; | ||
break; | ||
case 'pplanend': | ||
case 'planend': | ||
planend = value; | ||
break; | ||
case 'pclass': | ||
case 'class': | ||
itemClass = value; | ||
break; | ||
case 'plink': | ||
case 'link': | ||
link = value; | ||
break; | ||
case 'pmile': | ||
case 'mile': | ||
milestone = value; | ||
break; | ||
case 'pres': | ||
case 'res': | ||
resourceName = value; | ||
break; | ||
case 'pcomp': | ||
case 'comp': | ||
completion = value; | ||
break; | ||
case 'pgroup': | ||
case 'group': | ||
group = value; | ||
break; | ||
case 'pparent': | ||
case 'parent': | ||
parent = value; | ||
break; | ||
case 'popen': | ||
case 'open': | ||
open = value; | ||
break; | ||
case 'pdepend': | ||
case 'depend': | ||
dependsOn = value; | ||
break; | ||
case 'pcaption': | ||
case 'caption': | ||
caption = value; | ||
break; | ||
case 'pnotes': | ||
case 'notes': | ||
notes = value; | ||
break; | ||
case 'pcost': | ||
case 'cost': | ||
cost = value; | ||
break; | ||
case 'duration': | ||
case 'pduration': | ||
duration = value; | ||
break; | ||
default: | ||
additionalObject[property.toLowerCase()] = value; | ||
} | ||
for (let prop in pJsonObj[index]) { | ||
let property = prop; | ||
let value = pJsonObj[index][property]; | ||
switch (property.toLowerCase()) { | ||
case 'pid': | ||
case 'id': | ||
id = value; | ||
break; | ||
case 'pname': | ||
case 'name': | ||
name = value; | ||
break; | ||
case 'pstart': | ||
case 'start': | ||
start = value; | ||
break; | ||
case 'pend': | ||
case 'end': | ||
end = value; | ||
break; | ||
case 'pplanstart': | ||
case 'planstart': | ||
planstart = value; | ||
break; | ||
case 'pplanend': | ||
case 'planend': | ||
planend = value; | ||
break; | ||
case 'pclass': | ||
case 'class': | ||
itemClass = value; | ||
break; | ||
case 'plink': | ||
case 'link': | ||
link = value; | ||
break; | ||
case 'pmile': | ||
case 'mile': | ||
milestone = value; | ||
break; | ||
case 'pres': | ||
case 'res': | ||
resourceName = value; | ||
break; | ||
case 'pcomp': | ||
case 'comp': | ||
completion = value; | ||
break; | ||
case 'pgroup': | ||
case 'group': | ||
group = value; | ||
break; | ||
case 'pparent': | ||
case 'parent': | ||
parent = value; | ||
break; | ||
case 'popen': | ||
case 'open': | ||
open = value; | ||
break; | ||
case 'pdepend': | ||
case 'depend': | ||
dependsOn = value; | ||
break; | ||
case 'pcaption': | ||
case 'caption': | ||
caption = value; | ||
break; | ||
case 'pnotes': | ||
case 'notes': | ||
notes = value; | ||
break; | ||
case 'pcost': | ||
case 'cost': | ||
cost = value; | ||
break; | ||
case 'duration': | ||
case 'pduration': | ||
duration = value; | ||
break; | ||
default: | ||
additionalObject[property.toLowerCase()] = value; | ||
} | ||
} | ||
//if (id != undefined && !isNaN(parseInt(id)) && isFinite(id) && name && start && end && itemClass && completion != undefined && !isNaN(parseFloat(completion)) && isFinite(completion) && !isNaN(parseInt(parent)) && isFinite(parent)) { | ||
pGanttVar.AddTaskItem(new TaskItem(id, name, start, end, itemClass, link, milestone, resourceName, completion, group, parent, open, dependsOn, caption, notes, pGanttVar, cost, planstart, planend, duration, additionalObject)); | ||
//} | ||
} | ||
//if (id != undefined && !isNaN(parseInt(id)) && isFinite(id) && name && start && end && itemClass && completion != undefined && !isNaN(parseFloat(completion)) && isFinite(completion) && !isNaN(parseInt(parent)) && isFinite(parent)) { | ||
pGanttVar.AddTaskItem(new TaskItem(id, name, start, end, itemClass, link, milestone, resourceName, completion, group, parent, open, dependsOn, caption, notes, pGanttVar, cost, planstart, planend, duration, additionalObject)); | ||
//} | ||
} | ||
}; | ||
}; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
3
5272595
122665