Comparing version 0.3.6 to 0.3.7
@@ -125,5 +125,4 @@ var UTIL = require('util'), | ||
addNode: function(node, parents, children) { | ||
ASSERTS.absentId(node, this); | ||
var id = node.getId(); | ||
ASSERTS.absentId(id, this); | ||
@@ -170,5 +169,4 @@ this.nodes[id] = node; | ||
replaceNode: function(node, parents, children) { | ||
ASSERTS.hasId(node, this); | ||
var id = node.getId(); | ||
ASSERTS.hasId(id, this); | ||
@@ -225,5 +223,6 @@ if (parents || children) { | ||
ASSERTS.idTypeIsOk(id); | ||
id = U.getNodeId(id); | ||
ASSERTS.hasId(id, this); | ||
return U.hasLink(U.getNodeId(id), this, 'parents', parents); | ||
return U.hasLink(id, this, 'parents', parents); | ||
}, | ||
@@ -240,5 +239,6 @@ | ||
ASSERTS.idTypeIsOk(id); | ||
id = U.getNodeId(id); | ||
ASSERTS.hasId(id, this); | ||
return U.hasLink(U.getNodeId(id), this, 'children', children); | ||
return U.hasLink(id, this, 'children', children); | ||
}, | ||
@@ -254,5 +254,6 @@ | ||
ASSERTS.idTypeIsOk(id); | ||
id = U.getNodeId(id); | ||
ASSERTS.hasId(id, this); | ||
return [].concat(this.children[U.getNodeId(id)] || []); | ||
return [].concat(this.children[id] || []); | ||
}, | ||
@@ -268,5 +269,6 @@ | ||
ASSERTS.idTypeIsOk(id); | ||
id = U.getNodeId(id); | ||
ASSERTS.hasId(id, this); | ||
return [].concat(this.parents[U.getNodeId(id)] || []); | ||
return [].concat(this.parents[id] || []); | ||
}, | ||
@@ -354,4 +356,4 @@ | ||
unlink: function(id1, id2) { | ||
ASSERTS.idTypeIsOk(id1); | ||
ASSERTS.idTypeIsOk(id2); | ||
ASSERTS.idTypeIsString(id1); | ||
ASSERTS.idTypeIsString(id2); | ||
ASSERTS.hasId(id1, this); | ||
@@ -381,3 +383,3 @@ ASSERTS.hasId(id2, this); | ||
removeTree: function(id, forced) { | ||
ASSERTS.idTypeIsOk(id); | ||
ASSERTS.idTypeIsString(id); | ||
ASSERTS.hasId(id, this); | ||
@@ -384,0 +386,0 @@ |
@@ -20,3 +20,3 @@ /** | ||
var hasId = exports.hasId = function(id, arch, err) { | ||
if (!arch.hasNode(id)) throwError(err? err : 'There is no such id in arch.nodes: ' + id + '.'); | ||
if (!arch.hasNode(id)) throwError(err? err : 'There is no such id in arch.nodes: ' + id); | ||
}; | ||
@@ -33,3 +33,3 @@ | ||
var absentId = exports.absentId = function(id, arch, err) { | ||
if (arch.hasNode(id)) throwError(err? err : 'There is such id in arch.nodes: ' + id + '.'); | ||
if (arch.hasNode(id)) throwError(err? err : 'There is such id in arch.nodes: ' + id); | ||
}; | ||
@@ -46,4 +46,4 @@ | ||
var twoLinksInArch = exports.twoLinksInArch = function(id, arch, err) { | ||
if (!arch.parents[id]) throwError(err? err : 'There is no such id in arch.parents: ' + id + '.'); | ||
if (!arch.children[id]) throwError(err? err : 'There is no such id in arch.children: ' + id + '.'); | ||
if (!arch.parents[id]) throwError(err? err : 'There is no such id in arch.parents: ' + id); | ||
if (!arch.children[id]) throwError(err? err : 'There is no such id in arch.children: ' + id); | ||
}; | ||
@@ -60,4 +60,4 @@ | ||
var twoLinksInPlan = exports.twoLinksInPlan = function(id, plan, err) { | ||
if (!plan.parents[id]) throwError(err? err : 'There is no such id in plan(' + plan.getId() + ').parents: ' + id + '.'); | ||
if (!plan.children[id]) throwError(err? err : 'There is no such id in plan(' + plan.getId() + ').children: ' + id + '.'); | ||
if (!plan.parents[id]) throwError(err? err : 'There is no such id in plan(' + plan.getId() + ').parents: ' + id); | ||
if (!plan.children[id]) throwError(err? err : 'There is no such id in plan(' + plan.getId() + ').children: ' + id); | ||
}; | ||
@@ -99,3 +99,3 @@ | ||
exports.idTypeIsOk = function(id, err) { | ||
if (typeof id !== 'string' && !id.getId) throwError(err? err : 'Type of id(' + id + ') is not string and there are no getId function.'); | ||
if (typeof id !== 'string' && !id.getId) throwError(err? err : 'Type of id(' + id + ') is not string and there are no getId function'); | ||
}; | ||
@@ -124,4 +124,4 @@ | ||
exports.noIdLoop = function(id, parents, children, err) { | ||
if (parents && parents.indexOf(id) !== -1) throwError(err? err : 'Loop found, id is in parents: ' + id + '.'); | ||
if (children && children.indexOf(id) !== -1) throwError(err? err : 'Loop found, id is in children: ' + id + '.'); | ||
if (parents && parents.indexOf(id) !== -1) throwError(err? err : 'Loop found, id is in parents: ' + id); | ||
if (children && children.indexOf(id) !== -1) throwError(err? err : 'Loop found, id is in children: ' + id); | ||
}; | ||
@@ -140,3 +140,3 @@ | ||
parents.forEach(function(id) { | ||
if (children.indexOf(id) !== -1) throwError(err? err : 'Parents and children has same id in: ' + id + '.'); | ||
if (children.indexOf(id) !== -1) throwError(err? err : 'Parents and children has same id in: ' + id); | ||
}); | ||
@@ -155,6 +155,6 @@ } | ||
var k, n = 0; | ||
if (plan.jobs.length) throwError(err? err : 'There are jobs in plan(' + plan.getId() + ').'); | ||
if (plan.activeJobs.length) throwError(err? err : 'There are active jobs in plan(' + plan.getId() + ').'); | ||
if (plan.jobs.length) throwError(err? err : 'There are jobs in plan(' + plan.getId() + ')'); | ||
if (plan.activeJobs.length) throwError(err? err : 'There are active jobs in plan(' + plan.getId() + ')'); | ||
for (k in plan.parents) n++; | ||
if (n > 1) throwError(err? err : 'There are more than one node in plan(' + plan.getId() + ').parents.'); | ||
if (n > 1) throwError(err? err : 'There are more than one node in plan(' + plan.getId() + ').parents'); | ||
n = 0; | ||
@@ -178,6 +178,6 @@ for (k in plan.children) n++; | ||
for (k in children) { | ||
if (!parents[k]) throwError(err? err : 'In plan(' + plan.getId() + ') child(' + k + ') is absent in parents.'); | ||
if (!parents[k]) throwError(err? err : 'In plan(' + plan.getId() + ') child(' + k + ') is absent in parents'); | ||
} | ||
for (k in parents) { | ||
if (!children[k]) throwError(err? err : 'In plan(' + plan.getId() + ') parent(' + k + ') is absent in children.'); | ||
if (!children[k]) throwError(err? err : 'In plan(' + plan.getId() + ') parent(' + k + ') is absent in children'); | ||
} | ||
@@ -196,3 +196,3 @@ }; | ||
if (id == plan.root) return; | ||
if (!plan.parents[id].length) throwError(err? err: 'In plan(' + plan.getId() + ') node (' + id + ') not linked to root.'); | ||
if (!plan.parents[id].length) throwError(err? err: 'In plan(' + plan.getId() + ') node (' + id + ') not linked to root'); | ||
}); | ||
@@ -223,3 +223,3 @@ }; | ||
var notActiveJob = exports.notActiveJob = function(id, plan, err) { | ||
if (plan.isActiveJob(id)) throwError(err? err : 'Node(' + id + ') is active job in plan(' + plan.getId() + ').'); | ||
if (plan.isActiveJob(id)) throwError(err? err : 'Node(' + id + ') is active job in plan(' + plan.getId() + ')'); | ||
}; | ||
@@ -236,3 +236,3 @@ | ||
var notDoneJob = exports.notDoneJob = function(id, plan, err) { | ||
if (plan.doneJobs.indexOf(id) !== -1) throwError(err? err : 'Node(' + id + ') is done job in plan(' + plan.getId() + ').'); | ||
if (plan.doneJobs.indexOf(id) !== -1) throwError(err? err : 'Node(' + id + ') is done job in plan(' + plan.getId() + ')'); | ||
}; |
{ | ||
"name": "apw", | ||
"version": "0.3.6", | ||
"version": "0.3.7", | ||
"homepage": "http://github.com/bem/apw", | ||
@@ -25,3 +25,3 @@ "author": "Sergey Kryzhanovsky <skryzhanovsky@ya.ru> (http://github.com/afelix)", | ||
"engines": { | ||
"node": "0.6 | 0.7" | ||
"node": ">= 0.6.0" | ||
}, | ||
@@ -28,0 +28,0 @@ "dependencies": { |
Sorry, the diff of this file is not supported yet
Non-existent author
Supply chain riskThe package was published by an npm account that no longer exists.
Found 1 instance in 1 package
93847
2424
0