chain-commander
Advanced tools
Comparing version 1.2.1 to 2.0.0
{ | ||
"name": "chain-commander", | ||
"version": "1.2.1", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/pocesar/js-chain-commander" | ||
}, | ||
"authors": [ | ||
"Paulo Cesar https://github.com/pocesar" | ||
], | ||
"description": "Chain commander is a library based on Bluebird library, to encapsulate business rules logic in form of javascript objects or JSON.", | ||
"main": "./lib/chain-commander.js", | ||
"license": "MIT", | ||
"keywords": [ | ||
"workflow", | ||
"flow", | ||
"flowcontrol", | ||
"business logic", | ||
"business rule", | ||
"json", | ||
"pojo", | ||
"chain-of-responsibility", | ||
"chain-of-command", | ||
"promise", | ||
"conditional", | ||
"scriptable", | ||
"json script" | ||
], | ||
"ignore": [ | ||
"**/.*", | ||
"test", | ||
"node_modules", | ||
"bower_components" | ||
], | ||
"dependencies": { | ||
"bluebird": "*" | ||
}, | ||
"devDependencies": { | ||
"mocha": "1.x.x", | ||
"expect": "0.x.x" | ||
} | ||
} | ||
"name": "chain-commander", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/pocesar/js-chain-commander" | ||
}, | ||
"authors": [ | ||
"Paulo Cesar https://github.com/pocesar" | ||
], | ||
"description": "Chain commander is a library based on Bluebird library, to encapsulate business rules logic in form of javascript objects or JSON.", | ||
"main": "./lib/chain-commander.js", | ||
"license": "MIT", | ||
"keywords": [ | ||
"workflow", | ||
"flow", | ||
"flowcontrol", | ||
"business logic", | ||
"business rule", | ||
"json", | ||
"pojo", | ||
"chain-of-responsibility", | ||
"chain-of-command", | ||
"promise", | ||
"conditional", | ||
"scriptable", | ||
"json script" | ||
], | ||
"ignore": [ | ||
"**/.*", | ||
"test", | ||
"node_modules", | ||
"bower_components" | ||
], | ||
"dependencies": { | ||
"bluebird": ">=2" | ||
}, | ||
"devDependencies": { | ||
"mocha": "^2.4.5", | ||
"chai": "^3.5.0" | ||
} | ||
} |
{ | ||
"name": "chain-commander", | ||
"repo": "pocesar/js-chain-commander", | ||
"version": "1.2.1", | ||
"description": "Chain commander is a library based on Bluebird library, to encapsulate business rules logic in form of javascript objects or JSON.", | ||
"keywords": [ | ||
"workflow", | ||
"flow", | ||
"flowcontrol", | ||
"business logic", | ||
"business rule", | ||
"json", | ||
"pojo", | ||
"chain-of-responsibility", | ||
"chain-of-command", | ||
"promise", | ||
"conditional", | ||
"scriptable", | ||
"json script" | ||
], | ||
"dependencies": { | ||
"petkaantonov/bluebird": "*" | ||
}, | ||
"scripts": ["./lib/chain-commander.js"], | ||
"main": "./lib/chain-commander.js", | ||
"license": "MIT" | ||
"name": "chain-commander", | ||
"repo": "pocesar/js-chain-commander", | ||
"description": "Chain commander is a library based on Bluebird library, to encapsulate business rules logic in form of javascript objects or JSON.", | ||
"keywords": [ | ||
"workflow", | ||
"flow", | ||
"flowcontrol", | ||
"business logic", | ||
"business rule", | ||
"json", | ||
"pojo", | ||
"chain-of-responsibility", | ||
"chain-of-command", | ||
"promise", | ||
"conditional", | ||
"scriptable", | ||
"json script" | ||
], | ||
"dependencies": { | ||
"petkaantonov/bluebird": "*" | ||
}, | ||
"scripts": [ | ||
"./lib/chain-commander.js" | ||
], | ||
"main": "./lib/chain-commander.js", | ||
"license": "MIT" | ||
} |
@@ -1,1 +0,1 @@ | ||
{"G:\\www\\js-chain-commander\\lib\\chain-commander.js":{"path":"G:\\www\\js-chain-commander\\lib\\chain-commander.js","s":{"1":1,"2":1,"3":1,"4":0,"5":0,"6":0,"7":0,"8":0,"9":1,"10":0,"11":1,"12":67,"13":1,"14":67,"15":1,"16":36,"17":1,"18":440,"19":0,"20":0,"21":0,"22":0,"23":36,"24":36,"25":36,"26":0,"27":36,"28":36,"29":1,"30":52,"31":52,"32":50,"33":50,"34":50,"35":50,"36":1,"37":49,"38":49,"39":8,"40":49,"41":49,"42":10,"43":10,"44":1,"45":9,"46":50,"47":50,"48":20,"49":30,"50":1,"51":25,"52":25,"53":24,"54":24,"55":24,"56":24,"57":22,"58":22,"59":25,"60":25,"61":25,"62":25,"63":1,"64":24,"65":24,"66":24,"67":2,"68":1,"69":23,"70":23,"71":4,"72":23,"73":2,"74":2,"75":1,"76":1,"77":23,"78":23,"79":23,"80":22,"81":6,"82":6,"83":6,"84":6,"85":6,"86":6,"87":6,"88":22,"89":25,"90":22,"91":21,"92":21,"93":21,"94":13,"95":13,"96":8,"97":6,"98":21,"99":2,"100":1,"101":1,"102":36,"103":60,"104":60,"105":25,"106":25,"107":60,"108":37,"109":39,"110":39,"111":36,"112":1,"113":45,"114":13,"115":32,"116":32,"117":32,"118":32,"119":32,"120":1,"121":31,"122":4,"123":4,"124":27,"125":1,"126":3,"127":19,"128":19,"129":14,"130":4,"131":4,"132":14,"133":19,"134":19,"135":19,"136":3,"137":3,"138":6,"139":3,"140":16,"141":14,"142":2,"143":3,"144":13,"145":3,"146":1,"147":30,"148":1},"b":{"1":[1,0],"2":[0,0],"3":[0,0],"4":[0,0],"5":[1,0],"6":[1,66],"7":[0,440],"8":[0,0],"9":[0,0],"10":[1,49],"11":[50,3],"12":[8,41],"13":[1,9],"14":[20,30],"15":[22,2],"16":[1,24],"17":[2,22],"18":[1,1],"19":[4,19],"20":[1,1],"21":[13,8],"22":[21,13],"23":[6,2],"24":[8,8],"25":[1,1],"26":[25,35],"27":[37,23],"28":[13,32],"29":[32,24],"30":[0,32],"31":[5,27],"32":[4,28],"33":[32,31,5],"34":[1,31],"35":[32,5,5,2],"36":[4,27],"37":[19,3],"38":[4,10],"39":[3,16],"40":[14,2]},"f":{"1":1,"2":1,"3":0,"4":67,"5":36,"6":440,"7":0,"8":52,"9":50,"10":50,"11":50,"12":10,"13":50,"14":25,"15":24,"16":24,"17":25,"18":25,"19":24,"20":2,"21":23,"22":6,"23":6,"24":6,"25":21,"26":45,"27":3,"28":19,"29":14,"30":4,"31":19,"32":30},"fnMap":{"1":{"name":"(anonymous_1)","line":1,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":28}}},"2":{"name":"(anonymous_2)","line":18,"loc":{"start":{"line":18,"column":9},"end":{"line":18,"column":21}}},"3":{"name":"(anonymous_3)","line":22,"loc":{"start":{"line":22,"column":33},"end":{"line":22,"column":46}},"skip":true},"4":{"name":"convert","line":26,"loc":{"start":{"line":26,"column":2},"end":{"line":26,"column":23}}},"5":{"name":"parser","line":35,"loc":{"start":{"line":35,"column":2},"end":{"line":35,"column":40}}},"6":{"name":"log","line":39,"loc":{"start":{"line":39,"column":4},"end":{"line":39,"column":19}}},"7":{"name":"(anonymous_7)","line":55,"loc":{"start":{"line":55,"column":18},"end":{"line":55,"column":28}},"skip":true},"8":{"name":"exec","line":64,"loc":{"start":{"line":64,"column":4},"end":{"line":64,"column":26}}},"9":{"name":"execPromise","line":67,"loc":{"start":{"line":67,"column":13},"end":{"line":67,"column":48}}},"10":{"name":"(anonymous_10)","line":68,"loc":{"start":{"line":68,"column":21},"end":{"line":68,"column":46}}},"11":{"name":"(anonymous_11)","line":73,"loc":{"start":{"line":73,"column":16},"end":{"line":73,"column":27}}},"12":{"name":"(anonymous_12)","line":89,"loc":{"start":{"line":89,"column":17},"end":{"line":89,"column":31}}},"13":{"name":"(anonymous_13)","line":98,"loc":{"start":{"line":98,"column":16},"end":{"line":98,"column":29}}},"14":{"name":"ifblock","line":113,"loc":{"start":{"line":113,"column":4},"end":{"line":113,"column":29}}},"15":{"name":"ifblockPromise","line":116,"loc":{"start":{"line":116,"column":13},"end":{"line":116,"column":50}}},"16":{"name":"(anonymous_16)","line":118,"loc":{"start":{"line":118,"column":21},"end":{"line":118,"column":46}}},"17":{"name":"(anonymous_17)","line":125,"loc":{"start":{"line":125,"column":30},"end":{"line":125,"column":49}}},"18":{"name":"conditionalPromise","line":127,"loc":{"start":{"line":127,"column":21},"end":{"line":127,"column":54}}},"19":{"name":"(anonymous_19)","line":134,"loc":{"start":{"line":134,"column":31},"end":{"line":134,"column":41}}},"20":{"name":"(anonymous_20)","line":151,"loc":{"start":{"line":151,"column":25},"end":{"line":151,"column":38}}},"21":{"name":"(anonymous_21)","line":160,"loc":{"start":{"line":160,"column":24},"end":{"line":160,"column":37}}},"22":{"name":"(anonymous_22)","line":170,"loc":{"start":{"line":170,"column":34},"end":{"line":170,"column":50}}},"23":{"name":"conditionalelsePromise","line":172,"loc":{"start":{"line":172,"column":21},"end":{"line":172,"column":66}}},"24":{"name":"(anonymous_24)","line":179,"loc":{"start":{"line":179,"column":22},"end":{"line":179,"column":35}}},"25":{"name":"(anonymous_25)","line":193,"loc":{"start":{"line":193,"column":28},"end":{"line":193,"column":41}}},"26":{"name":"ChainCommander","line":244,"loc":{"start":{"line":244,"column":2},"end":{"line":244,"column":36}}},"27":{"name":"(anonymous_27)","line":280,"loc":{"start":{"line":280,"column":23},"end":{"line":280,"column":57}}},"28":{"name":"(anonymous_28)","line":284,"loc":{"start":{"line":284,"column":14},"end":{"line":284,"column":28}}},"29":{"name":"(anonymous_29)","line":287,"loc":{"start":{"line":287,"column":21},"end":{"line":287,"column":32}}},"30":{"name":"(anonymous_30)","line":289,"loc":{"start":{"line":289,"column":19},"end":{"line":289,"column":30}}},"31":{"name":"allFn","line":296,"loc":{"start":{"line":296,"column":15},"end":{"line":296,"column":35}}},"32":{"name":"(anonymous_32)","line":326,"loc":{"start":{"line":326,"column":37},"end":{"line":326,"column":63}}}},"statementMap":{"1":{"start":{"line":1,"column":0},"end":{"line":331,"column":3}},"2":{"start":{"line":4,"column":2},"end":{"line":16,"column":3}},"3":{"start":{"line":6,"column":4},"end":{"line":6,"column":32}},"4":{"start":{"line":7,"column":9},"end":{"line":16,"column":3},"skip":true},"5":{"start":{"line":9,"column":4},"end":{"line":9,"column":42},"skip":true},"6":{"start":{"line":12,"column":4},"end":{"line":14,"column":5},"skip":true},"7":{"start":{"line":13,"column":6},"end":{"line":13,"column":53},"skip":true},"8":{"start":{"line":15,"column":4},"end":{"line":15,"column":51},"skip":true},"9":{"start":{"line":22,"column":2},"end":{"line":24,"column":4},"skip":true},"10":{"start":{"line":23,"column":4},"end":{"line":23,"column":68},"skip":true},"11":{"start":{"line":26,"column":2},"end":{"line":33,"column":3}},"12":{"start":{"line":27,"column":4},"end":{"line":29,"column":5}},"13":{"start":{"line":28,"column":6},"end":{"line":28,"column":28}},"14":{"start":{"line":32,"column":4},"end":{"line":32,"column":44}},"15":{"start":{"line":35,"column":2},"end":{"line":235,"column":3}},"16":{"start":{"line":37,"column":4},"end":{"line":37,"column":52}},"17":{"start":{"line":39,"column":4},"end":{"line":48,"column":5}},"18":{"start":{"line":41,"column":6},"end":{"line":47,"column":7},"skip":true},"19":{"start":{"line":42,"column":8},"end":{"line":42,"column":57},"skip":true},"20":{"start":{"line":43,"column":8},"end":{"line":45,"column":9},"skip":true},"21":{"start":{"line":44,"column":10},"end":{"line":44,"column":30},"skip":true},"22":{"start":{"line":46,"column":8},"end":{"line":46,"column":41},"skip":true},"23":{"start":{"line":50,"column":4},"end":{"line":50,"column":23}},"24":{"start":{"line":52,"column":4},"end":{"line":52,"column":33}},"25":{"start":{"line":55,"column":4},"end":{"line":57,"column":6},"skip":true},"26":{"start":{"line":56,"column":6},"end":{"line":56,"column":31},"skip":true},"27":{"start":{"line":59,"column":4},"end":{"line":59,"column":27}},"28":{"start":{"line":62,"column":4},"end":{"line":62,"column":42},"skip":true},"29":{"start":{"line":64,"column":4},"end":{"line":111,"column":5}},"30":{"start":{"line":65,"column":6},"end":{"line":65,"column":22}},"31":{"start":{"line":67,"column":6},"end":{"line":110,"column":8}},"32":{"start":{"line":68,"column":8},"end":{"line":109,"column":11}},"33":{"start":{"line":69,"column":10},"end":{"line":69,"column":25}},"34":{"start":{"line":73,"column":10},"end":{"line":108,"column":13}},"35":{"start":{"line":76,"column":12},"end":{"line":78,"column":13}},"36":{"start":{"line":77,"column":14},"end":{"line":77,"column":84}},"37":{"start":{"line":79,"column":12},"end":{"line":79,"column":61}},"38":{"start":{"line":81,"column":12},"end":{"line":83,"column":13}},"39":{"start":{"line":82,"column":14},"end":{"line":82,"column":38}},"40":{"start":{"line":85,"column":12},"end":{"line":85,"column":64}},"41":{"start":{"line":87,"column":12},"end":{"line":87,"column":60}},"42":{"start":{"line":90,"column":12},"end":{"line":90,"column":34}},"43":{"start":{"line":92,"column":12},"end":{"line":96,"column":13}},"44":{"start":{"line":93,"column":14},"end":{"line":93,"column":26}},"45":{"start":{"line":95,"column":14},"end":{"line":95,"column":36}},"46":{"start":{"line":99,"column":12},"end":{"line":99,"column":34}},"47":{"start":{"line":101,"column":12},"end":{"line":107,"column":13}},"48":{"start":{"line":103,"column":14},"end":{"line":103,"column":36}},"49":{"start":{"line":106,"column":14},"end":{"line":106,"column":27}},"50":{"start":{"line":113,"column":4},"end":{"line":218,"column":5}},"51":{"start":{"line":114,"column":6},"end":{"line":114,"column":20}},"52":{"start":{"line":116,"column":6},"end":{"line":217,"column":8}},"53":{"start":{"line":117,"column":8},"end":{"line":117,"column":35}},"54":{"start":{"line":118,"column":8},"end":{"line":216,"column":11}},"55":{"start":{"line":119,"column":10},"end":{"line":119,"column":21}},"56":{"start":{"line":121,"column":10},"end":{"line":215,"column":11}},"57":{"start":{"line":123,"column":12},"end":{"line":123,"column":45}},"58":{"start":{"line":125,"column":12},"end":{"line":168,"column":14}},"59":{"start":{"line":126,"column":14},"end":{"line":126,"column":37}},"60":{"start":{"line":127,"column":14},"end":{"line":167,"column":16}},"61":{"start":{"line":128,"column":16},"end":{"line":128,"column":44}},"62":{"start":{"line":130,"column":16},"end":{"line":166,"column":17}},"63":{"start":{"line":132,"column":18},"end":{"line":132,"column":42}},"64":{"start":{"line":134,"column":18},"end":{"line":165,"column":21}},"65":{"start":{"line":136,"column":20},"end":{"line":136,"column":57}},"66":{"start":{"line":137,"column":20},"end":{"line":142,"column":21}},"67":{"start":{"line":139,"column":22},"end":{"line":141,"column":23}},"68":{"start":{"line":140,"column":24},"end":{"line":140,"column":94}},"69":{"start":{"line":143,"column":20},"end":{"line":143,"column":71}},"70":{"start":{"line":145,"column":20},"end":{"line":147,"column":21}},"71":{"start":{"line":146,"column":22},"end":{"line":146,"column":46}},"72":{"start":{"line":149,"column":20},"end":{"line":149,"column":70}},"73":{"start":{"line":153,"column":20},"end":{"line":153,"column":44}},"74":{"start":{"line":154,"column":20},"end":{"line":158,"column":21}},"75":{"start":{"line":155,"column":22},"end":{"line":155,"column":32}},"76":{"start":{"line":157,"column":22},"end":{"line":157,"column":35}},"77":{"start":{"line":162,"column":20},"end":{"line":162,"column":32}},"78":{"start":{"line":163,"column":20},"end":{"line":163,"column":49}},"79":{"start":{"line":164,"column":20},"end":{"line":164,"column":31}},"80":{"start":{"line":170,"column":12},"end":{"line":187,"column":14}},"81":{"start":{"line":171,"column":14},"end":{"line":171,"column":41}},"82":{"start":{"line":172,"column":14},"end":{"line":186,"column":16}},"83":{"start":{"line":173,"column":16},"end":{"line":173,"column":42}},"84":{"start":{"line":175,"column":16},"end":{"line":175,"column":50}},"85":{"start":{"line":177,"column":16},"end":{"line":185,"column":19}},"86":{"start":{"line":182,"column":18},"end":{"line":182,"column":51}},"87":{"start":{"line":184,"column":18},"end":{"line":184,"column":29}},"88":{"start":{"line":189,"column":12},"end":{"line":191,"column":13}},"89":{"start":{"line":190,"column":14},"end":{"line":190,"column":77}},"90":{"start":{"line":193,"column":12},"end":{"line":208,"column":15}},"91":{"start":{"line":194,"column":14},"end":{"line":194,"column":32}},"92":{"start":{"line":196,"column":14},"end":{"line":196,"column":54}},"93":{"start":{"line":199,"column":14},"end":{"line":205,"column":15}},"94":{"start":{"line":200,"column":16},"end":{"line":202,"column":17}},"95":{"start":{"line":201,"column":18},"end":{"line":201,"column":71}},"96":{"start":{"line":203,"column":21},"end":{"line":205,"column":15}},"97":{"start":{"line":204,"column":16},"end":{"line":204,"column":77}},"98":{"start":{"line":207,"column":14},"end":{"line":207,"column":33}},"99":{"start":{"line":210,"column":12},"end":{"line":214,"column":13}},"100":{"start":{"line":211,"column":14},"end":{"line":211,"column":59}},"101":{"start":{"line":213,"column":14},"end":{"line":213,"column":36}},"102":{"start":{"line":220,"column":4},"end":{"line":232,"column":5}},"103":{"start":{"line":221,"column":6},"end":{"line":221,"column":20}},"104":{"start":{"line":222,"column":6},"end":{"line":225,"column":7}},"105":{"start":{"line":223,"column":8},"end":{"line":223,"column":28}},"106":{"start":{"line":224,"column":8},"end":{"line":224,"column":48}},"107":{"start":{"line":226,"column":6},"end":{"line":231,"column":7}},"108":{"start":{"line":227,"column":8},"end":{"line":230,"column":9}},"109":{"start":{"line":228,"column":10},"end":{"line":228,"column":35}},"110":{"start":{"line":229,"column":10},"end":{"line":229,"column":47}},"111":{"start":{"line":234,"column":4},"end":{"line":234,"column":19}},"112":{"start":{"line":244,"column":2},"end":{"line":268,"column":3}},"113":{"start":{"line":245,"column":4},"end":{"line":247,"column":5}},"114":{"start":{"line":246,"column":6},"end":{"line":246,"column":43}},"115":{"start":{"line":249,"column":4},"end":{"line":249,"column":22}},"116":{"start":{"line":252,"column":4},"end":{"line":252,"column":60},"skip":true},"117":{"start":{"line":253,"column":4},"end":{"line":253,"column":63}},"118":{"start":{"line":254,"column":4},"end":{"line":256,"column":80}},"119":{"start":{"line":258,"column":4},"end":{"line":260,"column":5}},"120":{"start":{"line":259,"column":6},"end":{"line":259,"column":82}},"121":{"start":{"line":262,"column":4},"end":{"line":267,"column":5}},"122":{"start":{"line":263,"column":6},"end":{"line":263,"column":25}},"123":{"start":{"line":264,"column":6},"end":{"line":264,"column":53}},"124":{"start":{"line":266,"column":6},"end":{"line":266,"column":31}},"125":{"start":{"line":280,"column":2},"end":{"line":317,"column":4}},"126":{"start":{"line":282,"column":4},"end":{"line":310,"column":8}},"127":{"start":{"line":285,"column":8},"end":{"line":285,"column":47}},"128":{"start":{"line":287,"column":8},"end":{"line":294,"column":10}},"129":{"start":{"line":288,"column":10},"end":{"line":292,"column":11}},"130":{"start":{"line":289,"column":12},"end":{"line":291,"column":15}},"131":{"start":{"line":290,"column":14},"end":{"line":290,"column":35}},"132":{"start":{"line":293,"column":10},"end":{"line":293,"column":19}},"133":{"start":{"line":296,"column":8},"end":{"line":309,"column":10}},"134":{"start":{"line":297,"column":10},"end":{"line":297,"column":16}},"135":{"start":{"line":298,"column":10},"end":{"line":308,"column":11}},"136":{"start":{"line":299,"column":12},"end":{"line":299,"column":31}},"137":{"start":{"line":300,"column":12},"end":{"line":302,"column":13}},"138":{"start":{"line":301,"column":14},"end":{"line":301,"column":41}},"139":{"start":{"line":303,"column":12},"end":{"line":303,"column":21}},"140":{"start":{"line":304,"column":17},"end":{"line":308,"column":11}},"141":{"start":{"line":305,"column":12},"end":{"line":305,"column":60}},"142":{"start":{"line":307,"column":12},"end":{"line":307,"column":23}},"143":{"start":{"line":312,"column":4},"end":{"line":314,"column":5}},"144":{"start":{"line":313,"column":6},"end":{"line":313,"column":42}},"145":{"start":{"line":316,"column":4},"end":{"line":316,"column":18}},"146":{"start":{"line":326,"column":2},"end":{"line":328,"column":4}},"147":{"start":{"line":327,"column":4},"end":{"line":327,"column":58}},"148":{"start":{"line":330,"column":2},"end":{"line":330,"column":24}}},"branchMap":{"1":{"line":4,"type":"if","locations":[{"start":{"line":4,"column":2},"end":{"line":4,"column":2}},{"start":{"line":4,"column":2},"end":{"line":4,"column":2},"skip":true}]},"2":{"line":7,"type":"if","locations":[{"start":{"line":7,"column":9},"end":{"line":7,"column":9},"skip":true},{"start":{"line":7,"column":9},"end":{"line":7,"column":9},"skip":true}]},"3":{"line":7,"type":"binary-expr","locations":[{"start":{"line":7,"column":13},"end":{"line":7,"column":46},"skip":true},{"start":{"line":7,"column":50},"end":{"line":7,"column":65},"skip":true}]},"4":{"line":12,"type":"if","locations":[{"start":{"line":12,"column":4},"end":{"line":12,"column":4},"skip":true},{"start":{"line":12,"column":4},"end":{"line":12,"column":4},"skip":true}]},"5":{"line":22,"type":"binary-expr","locations":[{"start":{"line":22,"column":16},"end":{"line":22,"column":29},"skip":true},{"start":{"line":22,"column":33},"end":{"line":24,"column":3},"skip":true}]},"6":{"line":27,"type":"if","locations":[{"start":{"line":27,"column":4},"end":{"line":27,"column":4}},{"start":{"line":27,"column":4},"end":{"line":27,"column":4}}]},"7":{"line":41,"type":"if","locations":[{"start":{"line":41,"column":6},"end":{"line":41,"column":6},"skip":true},{"start":{"line":41,"column":6},"end":{"line":41,"column":6},"skip":true}]},"8":{"line":43,"type":"if","locations":[{"start":{"line":43,"column":8},"end":{"line":43,"column":8},"skip":true},{"start":{"line":43,"column":8},"end":{"line":43,"column":8},"skip":true}]},"9":{"line":43,"type":"binary-expr","locations":[{"start":{"line":43,"column":12},"end":{"line":43,"column":41},"skip":true},{"start":{"line":43,"column":45},"end":{"line":43,"column":83},"skip":true}]},"10":{"line":76,"type":"if","locations":[{"start":{"line":76,"column":12},"end":{"line":76,"column":12}},{"start":{"line":76,"column":12},"end":{"line":76,"column":12}}]},"11":{"line":76,"type":"binary-expr","locations":[{"start":{"line":76,"column":16},"end":{"line":76,"column":36}},{"start":{"line":76,"column":40},"end":{"line":76,"column":81}}]},"12":{"line":81,"type":"if","locations":[{"start":{"line":81,"column":12},"end":{"line":81,"column":12}},{"start":{"line":81,"column":12},"end":{"line":81,"column":12}}]},"13":{"line":92,"type":"if","locations":[{"start":{"line":92,"column":12},"end":{"line":92,"column":12}},{"start":{"line":92,"column":12},"end":{"line":92,"column":12}}]},"14":{"line":101,"type":"if","locations":[{"start":{"line":101,"column":12},"end":{"line":101,"column":12}},{"start":{"line":101,"column":12},"end":{"line":101,"column":12}}]},"15":{"line":121,"type":"if","locations":[{"start":{"line":121,"column":10},"end":{"line":121,"column":10}},{"start":{"line":121,"column":10},"end":{"line":121,"column":10}}]},"16":{"line":130,"type":"if","locations":[{"start":{"line":130,"column":16},"end":{"line":130,"column":16}},{"start":{"line":130,"column":16},"end":{"line":130,"column":16}}]},"17":{"line":137,"type":"if","locations":[{"start":{"line":137,"column":20},"end":{"line":137,"column":20}},{"start":{"line":137,"column":20},"end":{"line":137,"column":20}}]},"18":{"line":139,"type":"if","locations":[{"start":{"line":139,"column":22},"end":{"line":139,"column":22}},{"start":{"line":139,"column":22},"end":{"line":139,"column":22},"skip":true}]},"19":{"line":145,"type":"if","locations":[{"start":{"line":145,"column":20},"end":{"line":145,"column":20}},{"start":{"line":145,"column":20},"end":{"line":145,"column":20}}]},"20":{"line":154,"type":"if","locations":[{"start":{"line":154,"column":20},"end":{"line":154,"column":20}},{"start":{"line":154,"column":20},"end":{"line":154,"column":20}}]},"21":{"line":199,"type":"if","locations":[{"start":{"line":199,"column":14},"end":{"line":199,"column":14}},{"start":{"line":199,"column":14},"end":{"line":199,"column":14}}]},"22":{"line":199,"type":"binary-expr","locations":[{"start":{"line":199,"column":18},"end":{"line":199,"column":30}},{"start":{"line":199,"column":34},"end":{"line":199,"column":72}}]},"23":{"line":203,"type":"if","locations":[{"start":{"line":203,"column":21},"end":{"line":203,"column":21}},{"start":{"line":203,"column":21},"end":{"line":203,"column":21}}]},"24":{"line":203,"type":"binary-expr","locations":[{"start":{"line":203,"column":25},"end":{"line":203,"column":38}},{"start":{"line":203,"column":42},"end":{"line":203,"column":80}}]},"25":{"line":210,"type":"if","locations":[{"start":{"line":210,"column":12},"end":{"line":210,"column":12}},{"start":{"line":210,"column":12},"end":{"line":210,"column":12}}]},"26":{"line":222,"type":"if","locations":[{"start":{"line":222,"column":6},"end":{"line":222,"column":6}},{"start":{"line":222,"column":6},"end":{"line":222,"column":6}}]},"27":{"line":226,"type":"if","locations":[{"start":{"line":226,"column":6},"end":{"line":226,"column":6}},{"start":{"line":226,"column":6},"end":{"line":226,"column":6}}]},"28":{"line":245,"type":"if","locations":[{"start":{"line":245,"column":4},"end":{"line":245,"column":4}},{"start":{"line":245,"column":4},"end":{"line":245,"column":4}}]},"29":{"line":249,"type":"binary-expr","locations":[{"start":{"line":249,"column":11},"end":{"line":249,"column":15}},{"start":{"line":249,"column":19},"end":{"line":249,"column":21}}]},"30":{"line":252,"type":"cond-expr","locations":[{"start":{"line":252,"column":41},"end":{"line":252,"column":51},"skip":true},{"start":{"line":252,"column":54},"end":{"line":252,"column":59},"skip":true}]},"31":{"line":253,"type":"cond-expr","locations":[{"start":{"line":253,"column":43},"end":{"line":253,"column":54}},{"start":{"line":253,"column":57},"end":{"line":253,"column":62}}]},"32":{"line":254,"type":"cond-expr","locations":[{"start":{"line":256,"column":60},"end":{"line":256,"column":71}},{"start":{"line":256,"column":74},"end":{"line":256,"column":79}}]},"33":{"line":254,"type":"binary-expr","locations":[{"start":{"line":254,"column":18},"end":{"line":254,"column":41}},{"start":{"line":255,"column":18},"end":{"line":255,"column":49}},{"start":{"line":256,"column":18},"end":{"line":256,"column":57}}]},"34":{"line":258,"type":"if","locations":[{"start":{"line":258,"column":4},"end":{"line":258,"column":4}},{"start":{"line":258,"column":4},"end":{"line":258,"column":4}}]},"35":{"line":258,"type":"binary-expr","locations":[{"start":{"line":258,"column":8},"end":{"line":258,"column":19}},{"start":{"line":258,"column":23},"end":{"line":258,"column":46}},{"start":{"line":258,"column":50},"end":{"line":258,"column":81}},{"start":{"line":258,"column":85},"end":{"line":258,"column":106}}]},"36":{"line":262,"type":"if","locations":[{"start":{"line":262,"column":4},"end":{"line":262,"column":4}},{"start":{"line":262,"column":4},"end":{"line":262,"column":4}}]},"37":{"line":285,"type":"binary-expr","locations":[{"start":{"line":285,"column":18},"end":{"line":285,"column":31}},{"start":{"line":285,"column":35},"end":{"line":285,"column":46}}]},"38":{"line":288,"type":"if","locations":[{"start":{"line":288,"column":10},"end":{"line":288,"column":10}},{"start":{"line":288,"column":10},"end":{"line":288,"column":10}}]},"39":{"line":298,"type":"if","locations":[{"start":{"line":298,"column":10},"end":{"line":298,"column":10}},{"start":{"line":298,"column":10},"end":{"line":298,"column":10}}]},"40":{"line":304,"type":"if","locations":[{"start":{"line":304,"column":17},"end":{"line":304,"column":17}},{"start":{"line":304,"column":17},"end":{"line":304,"column":17}}]}}}} | ||
{"g:\\www\\js-chain-commander\\lib\\chain-commander.js":{"path":"g:\\www\\js-chain-commander\\lib\\chain-commander.js","s":{"1":1,"2":1,"3":1,"4":0,"5":0,"6":0,"7":0,"8":0,"9":1,"10":0,"11":1,"12":67,"13":1,"14":67,"15":1,"16":36,"17":36,"18":36,"19":36,"20":36,"21":36,"22":36,"23":1,"24":430,"25":0,"26":0,"27":0,"28":0,"29":36,"30":36,"31":36,"32":0,"33":36,"34":36,"35":1,"36":52,"37":52,"38":50,"39":50,"40":50,"41":50,"42":1,"43":49,"44":49,"45":8,"46":49,"47":49,"48":40,"49":40,"50":10,"51":30,"52":40,"53":10,"54":10,"55":1,"56":9,"57":10,"58":1,"59":25,"60":25,"61":24,"62":24,"63":24,"64":24,"65":22,"66":22,"67":25,"68":25,"69":25,"70":25,"71":1,"72":24,"73":24,"74":24,"75":2,"76":1,"77":23,"78":23,"79":4,"80":23,"81":22,"82":22,"83":22,"84":2,"85":2,"86":1,"87":1,"88":0,"89":1,"90":1,"91":22,"92":6,"93":6,"94":6,"95":6,"96":6,"97":6,"98":6,"99":22,"100":25,"101":22,"102":22,"103":22,"104":22,"105":13,"106":13,"107":9,"108":6,"109":22,"110":22,"111":2,"112":1,"113":1,"114":36,"115":60,"116":60,"117":25,"118":25,"119":60,"120":37,"121":39,"122":39,"123":36,"124":1,"125":45,"126":13,"127":32,"128":32,"129":32,"130":32,"131":32,"132":1,"133":31,"134":4,"135":4,"136":27,"137":1,"138":3,"139":3,"140":19,"141":19,"142":14,"143":4,"144":4,"145":4,"146":14,"147":19,"148":19,"149":19,"150":3,"151":3,"152":6,"153":3,"154":16,"155":14,"156":2,"157":3,"158":13,"159":3,"160":1,"161":30,"162":1},"b":{"1":[1,0],"2":[0,0],"3":[0,0],"4":[0,0],"5":[1,0],"6":[0,0,0],"7":[1,66],"8":[0,430],"9":[0,0],"10":[0,0],"11":[1,49],"12":[50,3],"13":[8,41],"14":[10,30],"15":[1,9],"16":[1,0],"17":[22,2],"18":[1,24],"19":[2,22],"20":[1,1],"21":[4,19],"22":[1,1],"23":[1,0],"24":[13,9],"25":[22,13],"26":[6,3],"27":[9,8],"28":[1,1],"29":[25,35],"30":[37,23],"31":[13,32],"32":[32,24],"33":[0,32],"34":[5,27],"35":[4,28],"36":[32,31,5],"37":[1,31],"38":[32,5,5,2],"39":[4,27],"40":[19,3],"41":[4,10],"42":[3,16],"43":[14,2]},"f":{"1":1,"2":1,"3":0,"4":67,"5":36,"6":430,"7":0,"8":52,"9":50,"10":50,"11":50,"12":40,"13":10,"14":25,"15":24,"16":24,"17":25,"18":25,"19":24,"20":22,"21":2,"22":6,"23":6,"24":6,"25":22,"26":45,"27":3,"28":19,"29":14,"30":4,"31":19,"32":30},"fnMap":{"1":{"name":"(anonymous_1)","line":1,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":29}}},"2":{"name":"(anonymous_2)","line":18,"loc":{"start":{"line":18,"column":9},"end":{"line":18,"column":22}}},"3":{"name":"(anonymous_3)","line":22,"loc":{"start":{"line":22,"column":35},"end":{"line":22,"column":50}},"skip":true},"4":{"name":"convert","line":26,"loc":{"start":{"line":26,"column":4},"end":{"line":26,"column":26}}},"5":{"name":"parser","line":35,"loc":{"start":{"line":35,"column":4},"end":{"line":35,"column":43}}},"6":{"name":"log","line":45,"loc":{"start":{"line":45,"column":8},"end":{"line":45,"column":23}}},"7":{"name":"(anonymous_7)","line":61,"loc":{"start":{"line":61,"column":22},"end":{"line":61,"column":34}},"skip":true},"8":{"name":"exec","line":70,"loc":{"start":{"line":70,"column":8},"end":{"line":70,"column":31}}},"9":{"name":"execPromise","line":73,"loc":{"start":{"line":73,"column":19},"end":{"line":73,"column":54}}},"10":{"name":"execPromiseItself","line":74,"loc":{"start":{"line":74,"column":29},"end":{"line":74,"column":73}}},"11":{"name":"tryExecPromise","line":79,"loc":{"start":{"line":79,"column":26},"end":{"line":79,"column":52}}},"12":{"name":"successExecPromise","line":95,"loc":{"start":{"line":95,"column":26},"end":{"line":95,"column":59}}},"13":{"name":"catchExecPromise","line":108,"loc":{"start":{"line":108,"column":27},"end":{"line":108,"column":58}}},"14":{"name":"ifblock","line":123,"loc":{"start":{"line":123,"column":8},"end":{"line":123,"column":34}}},"15":{"name":"ifblockPromise","line":126,"loc":{"start":{"line":126,"column":19},"end":{"line":126,"column":57}}},"16":{"name":"ifblockPromiseItself","line":128,"loc":{"start":{"line":128,"column":29},"end":{"line":128,"column":76}}},"17":{"name":"(anonymous_17)","line":135,"loc":{"start":{"line":135,"column":42},"end":{"line":135,"column":63}}},"18":{"name":"conditionalPromise","line":137,"loc":{"start":{"line":137,"column":35},"end":{"line":137,"column":69}}},"19":{"name":"tryConditional","line":144,"loc":{"start":{"line":144,"column":49},"end":{"line":144,"column":75}}},"20":{"name":"successConditional","line":163,"loc":{"start":{"line":163,"column":42},"end":{"line":163,"column":75}}},"21":{"name":"catchConditional","line":170,"loc":{"start":{"line":170,"column":43},"end":{"line":170,"column":74}}},"22":{"name":"(anonymous_22)","line":192,"loc":{"start":{"line":192,"column":46},"end":{"line":192,"column":63}}},"23":{"name":"conditionalelsePromise","line":194,"loc":{"start":{"line":194,"column":35},"end":{"line":194,"column":81}}},"24":{"name":"successConditionalElse","line":201,"loc":{"start":{"line":201,"column":38},"end":{"line":201,"column":75}}},"25":{"name":"successConditions","line":215,"loc":{"start":{"line":215,"column":40},"end":{"line":215,"column":72}}},"26":{"name":"ChainCommander","line":269,"loc":{"start":{"line":269,"column":4},"end":{"line":269,"column":39}}},"27":{"name":"(anonymous_27)","line":305,"loc":{"start":{"line":305,"column":25},"end":{"line":305,"column":61}}},"28":{"name":"(anonymous_28)","line":308,"loc":{"start":{"line":308,"column":20},"end":{"line":308,"column":36}}},"29":{"name":"(anonymous_29)","line":311,"loc":{"start":{"line":311,"column":25},"end":{"line":311,"column":38}}},"30":{"name":"(anonymous_30)","line":313,"loc":{"start":{"line":313,"column":27},"end":{"line":313,"column":40}}},"31":{"name":"allFn","line":322,"loc":{"start":{"line":322,"column":19},"end":{"line":322,"column":39}}},"32":{"name":"(anonymous_32)","line":352,"loc":{"start":{"line":352,"column":39},"end":{"line":352,"column":67}}}},"statementMap":{"1":{"start":{"line":1,"column":0},"end":{"line":357,"column":3}},"2":{"start":{"line":4,"column":4},"end":{"line":16,"column":5}},"3":{"start":{"line":6,"column":8},"end":{"line":6,"column":36}},"4":{"start":{"line":7,"column":11},"end":{"line":16,"column":5},"skip":true},"5":{"start":{"line":9,"column":8},"end":{"line":9,"column":46},"skip":true},"6":{"start":{"line":12,"column":8},"end":{"line":14,"column":9},"skip":true},"7":{"start":{"line":13,"column":12},"end":{"line":13,"column":59},"skip":true},"8":{"start":{"line":15,"column":8},"end":{"line":15,"column":55},"skip":true},"9":{"start":{"line":22,"column":4},"end":{"line":24,"column":6},"skip":true},"10":{"start":{"line":23,"column":8},"end":{"line":23,"column":75},"skip":true},"11":{"start":{"line":26,"column":4},"end":{"line":33,"column":5}},"12":{"start":{"line":27,"column":8},"end":{"line":29,"column":9}},"13":{"start":{"line":28,"column":12},"end":{"line":28,"column":34}},"14":{"start":{"line":32,"column":8},"end":{"line":32,"column":48}},"15":{"start":{"line":35,"column":4},"end":{"line":260,"column":5}},"16":{"start":{"line":36,"column":8},"end":{"line":36,"column":17}},"17":{"start":{"line":37,"column":8},"end":{"line":37,"column":19}},"18":{"start":{"line":38,"column":8},"end":{"line":38,"column":14}},"19":{"start":{"line":39,"column":8},"end":{"line":39,"column":14}},"20":{"start":{"line":40,"column":8},"end":{"line":40,"column":17}},"21":{"start":{"line":41,"column":8},"end":{"line":41,"column":17}},"22":{"start":{"line":43,"column":8},"end":{"line":43,"column":24}},"23":{"start":{"line":45,"column":8},"end":{"line":54,"column":9}},"24":{"start":{"line":47,"column":12},"end":{"line":53,"column":13},"skip":true},"25":{"start":{"line":48,"column":16},"end":{"line":48,"column":65},"skip":true},"26":{"start":{"line":49,"column":16},"end":{"line":51,"column":17},"skip":true},"27":{"start":{"line":50,"column":20},"end":{"line":50,"column":40},"skip":true},"28":{"start":{"line":52,"column":16},"end":{"line":52,"column":49},"skip":true},"29":{"start":{"line":56,"column":8},"end":{"line":56,"column":27}},"30":{"start":{"line":58,"column":8},"end":{"line":58,"column":37}},"31":{"start":{"line":61,"column":8},"end":{"line":63,"column":10},"skip":true},"32":{"start":{"line":62,"column":12},"end":{"line":62,"column":37},"skip":true},"33":{"start":{"line":65,"column":8},"end":{"line":65,"column":31}},"34":{"start":{"line":68,"column":8},"end":{"line":68,"column":46},"skip":true},"35":{"start":{"line":70,"column":8},"end":{"line":121,"column":9}},"36":{"start":{"line":71,"column":12},"end":{"line":71,"column":31}},"37":{"start":{"line":73,"column":12},"end":{"line":120,"column":14}},"38":{"start":{"line":74,"column":16},"end":{"line":119,"column":19}},"39":{"start":{"line":75,"column":20},"end":{"line":75,"column":38}},"40":{"start":{"line":79,"column":20},"end":{"line":118,"column":23}},"41":{"start":{"line":82,"column":24},"end":{"line":84,"column":25}},"42":{"start":{"line":83,"column":28},"end":{"line":83,"column":98}},"43":{"start":{"line":85,"column":24},"end":{"line":85,"column":73}},"44":{"start":{"line":87,"column":24},"end":{"line":89,"column":25}},"45":{"start":{"line":88,"column":28},"end":{"line":88,"column":52}},"46":{"start":{"line":91,"column":24},"end":{"line":91,"column":76}},"47":{"start":{"line":93,"column":24},"end":{"line":93,"column":72}},"48":{"start":{"line":96,"column":24},"end":{"line":96,"column":46}},"49":{"start":{"line":98,"column":24},"end":{"line":104,"column":25}},"50":{"start":{"line":100,"column":28},"end":{"line":100,"column":50}},"51":{"start":{"line":103,"column":28},"end":{"line":103,"column":41}},"52":{"start":{"line":106,"column":24},"end":{"line":106,"column":36}},"53":{"start":{"line":109,"column":24},"end":{"line":109,"column":46}},"54":{"start":{"line":111,"column":24},"end":{"line":115,"column":25}},"55":{"start":{"line":112,"column":28},"end":{"line":112,"column":105}},"56":{"start":{"line":114,"column":28},"end":{"line":114,"column":50}},"57":{"start":{"line":117,"column":24},"end":{"line":117,"column":36}},"58":{"start":{"line":123,"column":8},"end":{"line":242,"column":9}},"59":{"start":{"line":124,"column":12},"end":{"line":124,"column":34}},"60":{"start":{"line":126,"column":12},"end":{"line":241,"column":14}},"61":{"start":{"line":127,"column":16},"end":{"line":127,"column":51}},"62":{"start":{"line":128,"column":16},"end":{"line":240,"column":19}},"63":{"start":{"line":129,"column":20},"end":{"line":129,"column":31}},"64":{"start":{"line":131,"column":20},"end":{"line":239,"column":21}},"65":{"start":{"line":133,"column":24},"end":{"line":133,"column":57}},"66":{"start":{"line":135,"column":24},"end":{"line":190,"column":26}},"67":{"start":{"line":136,"column":28},"end":{"line":136,"column":59}},"68":{"start":{"line":137,"column":28},"end":{"line":189,"column":30}},"69":{"start":{"line":138,"column":32},"end":{"line":138,"column":71}},"70":{"start":{"line":140,"column":32},"end":{"line":188,"column":33}},"71":{"start":{"line":142,"column":36},"end":{"line":142,"column":60}},"72":{"start":{"line":144,"column":36},"end":{"line":186,"column":39}},"73":{"start":{"line":146,"column":40},"end":{"line":146,"column":85}},"74":{"start":{"line":148,"column":40},"end":{"line":153,"column":41}},"75":{"start":{"line":150,"column":44},"end":{"line":152,"column":45}},"76":{"start":{"line":151,"column":48},"end":{"line":151,"column":118}},"77":{"start":{"line":155,"column":40},"end":{"line":155,"column":91}},"78":{"start":{"line":157,"column":40},"end":{"line":159,"column":41}},"79":{"start":{"line":158,"column":44},"end":{"line":158,"column":68}},"80":{"start":{"line":161,"column":40},"end":{"line":161,"column":90}},"81":{"start":{"line":165,"column":40},"end":{"line":165,"column":52}},"82":{"start":{"line":166,"column":40},"end":{"line":166,"column":77}},"83":{"start":{"line":168,"column":40},"end":{"line":168,"column":51}},"84":{"start":{"line":172,"column":40},"end":{"line":172,"column":72}},"85":{"start":{"line":174,"column":40},"end":{"line":183,"column":41}},"86":{"start":{"line":176,"column":44},"end":{"line":180,"column":45}},"87":{"start":{"line":177,"column":48},"end":{"line":177,"column":60}},"88":{"start":{"line":179,"column":48},"end":{"line":179,"column":71},"skip":true},"89":{"start":{"line":182,"column":44},"end":{"line":182,"column":57}},"90":{"start":{"line":185,"column":40},"end":{"line":185,"column":52}},"91":{"start":{"line":192,"column":24},"end":{"line":209,"column":26}},"92":{"start":{"line":193,"column":28},"end":{"line":193,"column":63}},"93":{"start":{"line":194,"column":28},"end":{"line":208,"column":30}},"94":{"start":{"line":195,"column":32},"end":{"line":195,"column":69}},"95":{"start":{"line":197,"column":32},"end":{"line":197,"column":74}},"96":{"start":{"line":199,"column":32},"end":{"line":207,"column":35}},"97":{"start":{"line":204,"column":36},"end":{"line":204,"column":69}},"98":{"start":{"line":206,"column":36},"end":{"line":206,"column":47}},"99":{"start":{"line":211,"column":24},"end":{"line":213,"column":25}},"100":{"start":{"line":212,"column":28},"end":{"line":212,"column":91}},"101":{"start":{"line":215,"column":24},"end":{"line":232,"column":27}},"102":{"start":{"line":216,"column":28},"end":{"line":216,"column":54}},"103":{"start":{"line":218,"column":28},"end":{"line":218,"column":68}},"104":{"start":{"line":221,"column":28},"end":{"line":227,"column":29}},"105":{"start":{"line":222,"column":32},"end":{"line":224,"column":33}},"106":{"start":{"line":223,"column":36},"end":{"line":223,"column":89}},"107":{"start":{"line":225,"column":35},"end":{"line":227,"column":29}},"108":{"start":{"line":226,"column":32},"end":{"line":226,"column":93}},"109":{"start":{"line":229,"column":28},"end":{"line":229,"column":47}},"110":{"start":{"line":231,"column":28},"end":{"line":231,"column":40}},"111":{"start":{"line":234,"column":24},"end":{"line":238,"column":25}},"112":{"start":{"line":235,"column":28},"end":{"line":235,"column":73}},"113":{"start":{"line":237,"column":28},"end":{"line":237,"column":50}},"114":{"start":{"line":244,"column":8},"end":{"line":257,"column":9}},"115":{"start":{"line":245,"column":12},"end":{"line":245,"column":26}},"116":{"start":{"line":246,"column":12},"end":{"line":249,"column":13}},"117":{"start":{"line":247,"column":16},"end":{"line":247,"column":36}},"118":{"start":{"line":248,"column":16},"end":{"line":248,"column":56}},"119":{"start":{"line":251,"column":12},"end":{"line":256,"column":13}},"120":{"start":{"line":252,"column":16},"end":{"line":255,"column":17}},"121":{"start":{"line":253,"column":20},"end":{"line":253,"column":45}},"122":{"start":{"line":254,"column":20},"end":{"line":254,"column":57}},"123":{"start":{"line":259,"column":8},"end":{"line":259,"column":23}},"124":{"start":{"line":269,"column":4},"end":{"line":293,"column":5}},"125":{"start":{"line":270,"column":8},"end":{"line":272,"column":9}},"126":{"start":{"line":271,"column":12},"end":{"line":271,"column":49}},"127":{"start":{"line":274,"column":8},"end":{"line":274,"column":26}},"128":{"start":{"line":277,"column":8},"end":{"line":277,"column":64},"skip":true},"129":{"start":{"line":278,"column":8},"end":{"line":278,"column":67}},"130":{"start":{"line":279,"column":8},"end":{"line":281,"column":74}},"131":{"start":{"line":283,"column":8},"end":{"line":285,"column":9}},"132":{"start":{"line":284,"column":12},"end":{"line":284,"column":88}},"133":{"start":{"line":287,"column":8},"end":{"line":292,"column":9}},"134":{"start":{"line":288,"column":12},"end":{"line":288,"column":31}},"135":{"start":{"line":289,"column":12},"end":{"line":289,"column":59}},"136":{"start":{"line":291,"column":12},"end":{"line":291,"column":37}},"137":{"start":{"line":305,"column":4},"end":{"line":343,"column":6}},"138":{"start":{"line":307,"column":8},"end":{"line":307,"column":38}},"139":{"start":{"line":308,"column":8},"end":{"line":336,"column":10}},"140":{"start":{"line":309,"column":12},"end":{"line":309,"column":51}},"141":{"start":{"line":311,"column":12},"end":{"line":320,"column":14}},"142":{"start":{"line":312,"column":16},"end":{"line":318,"column":17}},"143":{"start":{"line":313,"column":20},"end":{"line":317,"column":23}},"144":{"start":{"line":314,"column":24},"end":{"line":314,"column":45}},"145":{"start":{"line":316,"column":24},"end":{"line":316,"column":36}},"146":{"start":{"line":319,"column":16},"end":{"line":319,"column":25}},"147":{"start":{"line":322,"column":12},"end":{"line":335,"column":14}},"148":{"start":{"line":323,"column":16},"end":{"line":323,"column":22}},"149":{"start":{"line":324,"column":16},"end":{"line":334,"column":17}},"150":{"start":{"line":325,"column":20},"end":{"line":325,"column":39}},"151":{"start":{"line":326,"column":20},"end":{"line":328,"column":21}},"152":{"start":{"line":327,"column":24},"end":{"line":327,"column":51}},"153":{"start":{"line":329,"column":20},"end":{"line":329,"column":29}},"154":{"start":{"line":330,"column":23},"end":{"line":334,"column":17}},"155":{"start":{"line":331,"column":20},"end":{"line":331,"column":68}},"156":{"start":{"line":333,"column":20},"end":{"line":333,"column":31}},"157":{"start":{"line":338,"column":8},"end":{"line":340,"column":9}},"158":{"start":{"line":339,"column":12},"end":{"line":339,"column":48}},"159":{"start":{"line":342,"column":8},"end":{"line":342,"column":22}},"160":{"start":{"line":352,"column":4},"end":{"line":354,"column":6}},"161":{"start":{"line":353,"column":8},"end":{"line":353,"column":62}},"162":{"start":{"line":356,"column":4},"end":{"line":356,"column":26}}},"branchMap":{"1":{"line":4,"type":"if","locations":[{"start":{"line":4,"column":4},"end":{"line":4,"column":4}},{"start":{"line":4,"column":4},"end":{"line":4,"column":4},"skip":true}]},"2":{"line":7,"type":"if","locations":[{"start":{"line":7,"column":11},"end":{"line":7,"column":11},"skip":true},{"start":{"line":7,"column":11},"end":{"line":7,"column":11},"skip":true}]},"3":{"line":7,"type":"binary-expr","locations":[{"start":{"line":7,"column":15},"end":{"line":7,"column":43},"skip":true},{"start":{"line":7,"column":47},"end":{"line":7,"column":57},"skip":true}]},"4":{"line":12,"type":"if","locations":[{"start":{"line":12,"column":8},"end":{"line":12,"column":8},"skip":true},{"start":{"line":12,"column":8},"end":{"line":12,"column":8},"skip":true}]},"5":{"line":22,"type":"binary-expr","locations":[{"start":{"line":22,"column":18},"end":{"line":22,"column":31},"skip":true},{"start":{"line":22,"column":35},"end":{"line":24,"column":5},"skip":true}]},"6":{"line":23,"type":"binary-expr","locations":[{"start":{"line":23,"column":15},"end":{"line":23,"column":18},"skip":true},{"start":{"line":23,"column":22},"end":{"line":23,"column":45},"skip":true},{"start":{"line":23,"column":49},"end":{"line":23,"column":74},"skip":true}]},"7":{"line":27,"type":"if","locations":[{"start":{"line":27,"column":8},"end":{"line":27,"column":8}},{"start":{"line":27,"column":8},"end":{"line":27,"column":8}}]},"8":{"line":47,"type":"if","locations":[{"start":{"line":47,"column":12},"end":{"line":47,"column":12},"skip":true},{"start":{"line":47,"column":12},"end":{"line":47,"column":12},"skip":true}]},"9":{"line":49,"type":"if","locations":[{"start":{"line":49,"column":16},"end":{"line":49,"column":16},"skip":true},{"start":{"line":49,"column":16},"end":{"line":49,"column":16},"skip":true}]},"10":{"line":49,"type":"binary-expr","locations":[{"start":{"line":49,"column":20},"end":{"line":49,"column":49},"skip":true},{"start":{"line":49,"column":53},"end":{"line":49,"column":91},"skip":true}]},"11":{"line":82,"type":"if","locations":[{"start":{"line":82,"column":24},"end":{"line":82,"column":24}},{"start":{"line":82,"column":24},"end":{"line":82,"column":24}}]},"12":{"line":82,"type":"binary-expr","locations":[{"start":{"line":82,"column":28},"end":{"line":82,"column":48}},{"start":{"line":82,"column":52},"end":{"line":82,"column":93}}]},"13":{"line":87,"type":"if","locations":[{"start":{"line":87,"column":24},"end":{"line":87,"column":24}},{"start":{"line":87,"column":24},"end":{"line":87,"column":24}}]},"14":{"line":98,"type":"if","locations":[{"start":{"line":98,"column":24},"end":{"line":98,"column":24}},{"start":{"line":98,"column":24},"end":{"line":98,"column":24}}]},"15":{"line":111,"type":"if","locations":[{"start":{"line":111,"column":24},"end":{"line":111,"column":24}},{"start":{"line":111,"column":24},"end":{"line":111,"column":24}}]},"16":{"line":112,"type":"cond-expr","locations":[{"start":{"line":112,"column":58},"end":{"line":112,"column":61}},{"start":{"line":112,"column":89},"end":{"line":112,"column":103},"skip":true}]},"17":{"line":131,"type":"if","locations":[{"start":{"line":131,"column":20},"end":{"line":131,"column":20}},{"start":{"line":131,"column":20},"end":{"line":131,"column":20}}]},"18":{"line":140,"type":"if","locations":[{"start":{"line":140,"column":32},"end":{"line":140,"column":32}},{"start":{"line":140,"column":32},"end":{"line":140,"column":32}}]},"19":{"line":148,"type":"if","locations":[{"start":{"line":148,"column":40},"end":{"line":148,"column":40}},{"start":{"line":148,"column":40},"end":{"line":148,"column":40}}]},"20":{"line":150,"type":"if","locations":[{"start":{"line":150,"column":44},"end":{"line":150,"column":44}},{"start":{"line":150,"column":44},"end":{"line":150,"column":44},"skip":true}]},"21":{"line":157,"type":"if","locations":[{"start":{"line":157,"column":40},"end":{"line":157,"column":40}},{"start":{"line":157,"column":40},"end":{"line":157,"column":40}}]},"22":{"line":174,"type":"if","locations":[{"start":{"line":174,"column":40},"end":{"line":174,"column":40}},{"start":{"line":174,"column":40},"end":{"line":174,"column":40}}]},"23":{"line":176,"type":"if","locations":[{"start":{"line":176,"column":44},"end":{"line":176,"column":44}},{"start":{"line":176,"column":44},"end":{"line":176,"column":44},"skip":true}]},"24":{"line":221,"type":"if","locations":[{"start":{"line":221,"column":28},"end":{"line":221,"column":28}},{"start":{"line":221,"column":28},"end":{"line":221,"column":28}}]},"25":{"line":221,"type":"binary-expr","locations":[{"start":{"line":221,"column":32},"end":{"line":221,"column":44}},{"start":{"line":221,"column":48},"end":{"line":221,"column":86}}]},"26":{"line":225,"type":"if","locations":[{"start":{"line":225,"column":35},"end":{"line":225,"column":35}},{"start":{"line":225,"column":35},"end":{"line":225,"column":35}}]},"27":{"line":225,"type":"binary-expr","locations":[{"start":{"line":225,"column":39},"end":{"line":225,"column":52}},{"start":{"line":225,"column":56},"end":{"line":225,"column":94}}]},"28":{"line":234,"type":"if","locations":[{"start":{"line":234,"column":24},"end":{"line":234,"column":24}},{"start":{"line":234,"column":24},"end":{"line":234,"column":24}}]},"29":{"line":246,"type":"if","locations":[{"start":{"line":246,"column":12},"end":{"line":246,"column":12}},{"start":{"line":246,"column":12},"end":{"line":246,"column":12}}]},"30":{"line":251,"type":"if","locations":[{"start":{"line":251,"column":12},"end":{"line":251,"column":12}},{"start":{"line":251,"column":12},"end":{"line":251,"column":12}}]},"31":{"line":270,"type":"if","locations":[{"start":{"line":270,"column":8},"end":{"line":270,"column":8}},{"start":{"line":270,"column":8},"end":{"line":270,"column":8}}]},"32":{"line":274,"type":"binary-expr","locations":[{"start":{"line":274,"column":15},"end":{"line":274,"column":19}},{"start":{"line":274,"column":23},"end":{"line":274,"column":25}}]},"33":{"line":277,"type":"cond-expr","locations":[{"start":{"line":277,"column":45},"end":{"line":277,"column":55},"skip":true},{"start":{"line":277,"column":58},"end":{"line":277,"column":63},"skip":true}]},"34":{"line":278,"type":"cond-expr","locations":[{"start":{"line":278,"column":47},"end":{"line":278,"column":58}},{"start":{"line":278,"column":61},"end":{"line":278,"column":66}}]},"35":{"line":279,"type":"cond-expr","locations":[{"start":{"line":281,"column":54},"end":{"line":281,"column":65}},{"start":{"line":281,"column":68},"end":{"line":281,"column":73}}]},"36":{"line":279,"type":"binary-expr","locations":[{"start":{"line":279,"column":22},"end":{"line":279,"column":45}},{"start":{"line":280,"column":12},"end":{"line":280,"column":43}},{"start":{"line":281,"column":12},"end":{"line":281,"column":51}}]},"37":{"line":283,"type":"if","locations":[{"start":{"line":283,"column":8},"end":{"line":283,"column":8}},{"start":{"line":283,"column":8},"end":{"line":283,"column":8}}]},"38":{"line":283,"type":"binary-expr","locations":[{"start":{"line":283,"column":12},"end":{"line":283,"column":23}},{"start":{"line":283,"column":27},"end":{"line":283,"column":50}},{"start":{"line":283,"column":54},"end":{"line":283,"column":85}},{"start":{"line":283,"column":89},"end":{"line":283,"column":110}}]},"39":{"line":287,"type":"if","locations":[{"start":{"line":287,"column":8},"end":{"line":287,"column":8}},{"start":{"line":287,"column":8},"end":{"line":287,"column":8}}]},"40":{"line":309,"type":"binary-expr","locations":[{"start":{"line":309,"column":22},"end":{"line":309,"column":35}},{"start":{"line":309,"column":39},"end":{"line":309,"column":50}}]},"41":{"line":312,"type":"if","locations":[{"start":{"line":312,"column":16},"end":{"line":312,"column":16}},{"start":{"line":312,"column":16},"end":{"line":312,"column":16}}]},"42":{"line":324,"type":"if","locations":[{"start":{"line":324,"column":16},"end":{"line":324,"column":16}},{"start":{"line":324,"column":16},"end":{"line":324,"column":16}}]},"43":{"line":330,"type":"if","locations":[{"start":{"line":330,"column":23},"end":{"line":330,"column":23}},{"start":{"line":330,"column":23},"end":{"line":330,"column":23}}]}}}} |
@@ -1,39 +0,39 @@ | ||
module.exports = function(grunt) { | ||
grunt.initConfig({ | ||
'mocha_istanbul': { | ||
coverage: { | ||
src: 'test', | ||
options: { | ||
reporter: 'dot', | ||
quiet: true | ||
module.exports = function (grunt) { | ||
grunt.initConfig({ | ||
'mocha_istanbul': { | ||
coverage: { | ||
src: 'test', | ||
options: { | ||
reporter: 'dot', | ||
quiet: true | ||
} | ||
}, | ||
coveralls: { | ||
src: 'test', | ||
options: { | ||
reporter: 'dot', | ||
coverage: true, | ||
quiet: true | ||
} | ||
} | ||
} | ||
}, | ||
coveralls: { | ||
src: 'test', | ||
options: { | ||
reporter: 'dot', | ||
coverage: true, | ||
quiet: true | ||
} | ||
} | ||
} | ||
}); | ||
}); | ||
grunt.event.on('coverage', function(data, done){ | ||
var coveralls = require('coveralls'); | ||
grunt.event.on('coverage', function (data, done) { | ||
var coveralls = require('coveralls'); | ||
coveralls.handleInput(data, function(err){ | ||
if (err) { | ||
done(err); | ||
} else { | ||
done(); | ||
} | ||
coveralls.handleInput(data, function (err) { | ||
if (err) { | ||
done(err); | ||
} else { | ||
done(); | ||
} | ||
}); | ||
}); | ||
}); | ||
grunt.loadNpmTasks('grunt-mocha-istanbul'); | ||
grunt.loadNpmTasks('grunt-mocha-istanbul'); | ||
grunt.registerTask('coveralls', ['mocha_istanbul:coveralls']); | ||
grunt.registerTask('coverage', ['mocha_istanbul:coverage']); | ||
grunt.registerTask('coveralls', ['mocha_istanbul:coveralls']); | ||
grunt.registerTask('coverage', ['mocha_istanbul:coverage']); | ||
}; |
@@ -1,331 +0,357 @@ | ||
(function (root, definition){ | ||
(function (root, definition) { | ||
/* istanbul ignore else: untestable */ | ||
if (typeof exports === 'object') { | ||
/* CommonJS/Node.js */ | ||
module.exports = definition; | ||
} else if (typeof root.define === 'function' && root.define.amd) { | ||
/* RequireJS */ | ||
root.define(['bluebird'], definition); | ||
} else { | ||
/* <script> */ | ||
if (typeof root.Promise === 'undefined') { | ||
throw new Error('bluebird library is missing'); | ||
/* istanbul ignore else: untestable */ | ||
if (typeof exports === 'object') { | ||
/* CommonJS/Node.js */ | ||
module.exports = definition; | ||
} else if (typeof define === 'function' && define.amd) { | ||
/* RequireJS */ | ||
root.define(['bluebird'], definition); | ||
} else { | ||
/* <script> */ | ||
if (typeof root.Promise === 'undefined') { | ||
throw new Error('bluebird library is missing'); | ||
} | ||
root.ChainCommander = definition(root.Promise); | ||
} | ||
root.ChainCommander = definition(root.Promise); | ||
} | ||
})(this, function (Q){ | ||
'use strict'; | ||
})(this, function (Q) { | ||
'use strict'; | ||
/* istanbul ignore next:polyfill should not be tested*/ | ||
var isArray = Array.isArray || function(val){ | ||
return Object.prototype.toString.call(val) === '[object Array]'; | ||
}; | ||
/* istanbul ignore next:polyfill should not be tested*/ | ||
var isArray = Array.isArray || function (val) { | ||
return val && typeof val === 'object' && val.constructor === Array; | ||
}; | ||
function convert(obj){ | ||
if (typeof obj === 'string') { | ||
obj = JSON.parse(obj); | ||
function convert(obj) { | ||
if (typeof obj === 'string') { | ||
obj = JSON.parse(obj); | ||
} | ||
/* Normalize it to always create an array from the obj */ | ||
return Array.prototype.concat.call(obj); | ||
} | ||
/* Normalize it to always create an array from the obj */ | ||
return Array.prototype.concat.call(obj); | ||
} | ||
function parser(obj, initial, context) { | ||
var _top; | ||
var _inner; | ||
var i; | ||
var j; | ||
var ilen; | ||
var jlen; | ||
/*jshint validthis:true */ | ||
var self = this; | ||
function parser(obj, initial, context){ | ||
/*jshint validthis:true */ | ||
var _top, _inner, i, j, ilen, jlen, self = this; | ||
function log() { | ||
/* istanbul ignore next: untestable */ | ||
if (self.debug === true) { | ||
var args = Array.prototype.slice.call(arguments); | ||
if (typeof args[1] === 'function' && typeof args[1].__debug !== 'undefined') { | ||
args[1] = args[1](); | ||
} | ||
console.log.apply(console, args); | ||
} | ||
} | ||
function log() { | ||
/* istanbul ignore next: untestable */ | ||
if (self.debug === true) { | ||
var args = Array.prototype.slice.call(arguments); | ||
if (typeof args[1] === 'function' && typeof args[1].__debug !== 'undefined') { | ||
args[1] = args[1](); | ||
obj = convert(obj); | ||
initial = Q.resolve(initial); | ||
/*istanbul ignore next:debug stuff*/ | ||
var inspect = function () { | ||
return initial.reflect(); | ||
}; | ||
inspect.__debug = true; | ||
/*istanbul ignore next:debug stuff*/ | ||
log('initial promise state', inspect); | ||
function exec(parsing) { | ||
log('exec before'); | ||
/* create a promise from any return value from the "exec" functions, including other promises */ | ||
return function execPromise(currentValue) { | ||
return new Q(function execPromiseItself(resolve, reject) { | ||
log('exec after'); | ||
/* we need to separate from the main promise chain, since, we don't want it to fail, we need it | ||
to keep going regardless of rejected, since its up to the user on how to deal with the value */ | ||
Q.try(function tryExecPromise() { | ||
/* Does the exec function return a value or a promise? Doesn't matter */ | ||
/* Pass in the current value as the last parameter, always. */ | ||
if (self.throws === true && typeof context[parsing[0]] !== 'function') { | ||
throw new Error('"exec" function "' + parsing[0] + '" doesnt exists'); | ||
} | ||
var args = parsing.slice(1).concat(currentValue); | ||
if (self.context) { | ||
args.push(self.context); | ||
} | ||
log('exec try', parsing, context[parsing[0]], args); | ||
return context[parsing[0]].apply(context, args); | ||
}) | ||
.then(function successExecPromise(val) { | ||
log('exec done', val); | ||
if (val === void 0) { | ||
/* resolve with the current value, the function had no "return" */ | ||
resolve(currentValue); | ||
} else { | ||
/* everything went well, resolve with the new value */ | ||
resolve(val); | ||
} | ||
return null; | ||
}) | ||
.catch(function catchExecPromise(err) { | ||
log('exec fail', err); | ||
/* The function threw an exception, we need to continue with the unchanged value */ | ||
if (self.throws === true) { | ||
reject(err instanceof Error ? err : /*istanbul ignore next*/ new Error(err)); | ||
} else { | ||
resolve(currentValue); | ||
} | ||
return null; | ||
}); | ||
}); | ||
}; | ||
} | ||
console.log.apply(console, args); | ||
} | ||
} | ||
obj = convert(obj); | ||
function ifblock(parsing) { | ||
log('ifblock before'); | ||
/* return a promise from an ifblock, and add it do the promise chain */ | ||
return function ifblockPromise(currentValue) { | ||
log('ifblock after', currentValue); | ||
return new Q(function ifblockPromiseItself(resolve, reject) { | ||
var i, len; | ||
initial = Q.resolve(initial); | ||
if (typeof parsing['check'] !== 'undefined') { | ||
/* side promise */ | ||
var conditions = Q.resolve(true); | ||
/*istanbul ignore next:debug stuff*/ | ||
var inspect = function(){ | ||
return initial.inspect(); | ||
}; | ||
var conditional = function (condition) { | ||
log('ifblock conditional out'); | ||
return function conditionalPromise(bool) { | ||
log('ifblock conditional after', bool); | ||
/* starts at undefined, that if it doesnt become true, it will be typecasted to boolean false */ | ||
if (bool === false) { | ||
/* previous if check failed, just stop it before calling the other function */ | ||
return Q.resolve(false); | ||
} else { | ||
return Q.try(function tryConditional() { | ||
/* the function return a future value, regardless if it's a promise or a primitive value */ | ||
log('ifblock conditional try', condition[0]); | ||
inspect.__debug = true; | ||
if (self.throws === true) { | ||
/* istanbul ignore else */ | ||
if (typeof context[condition[0]] !== 'function') { | ||
throw new Error('"if" function "' + condition[0] + '" doesnt exists'); | ||
} | ||
} | ||
/*istanbul ignore next:debug stuff*/ | ||
log('initial promise state', inspect); | ||
var args = condition.slice(1).concat(currentValue); | ||
function exec(parsing){ | ||
log('exec out'); | ||
/* create a promise from any return value from the "exec" functions, including other promises */ | ||
return function execPromise(currentValue) { | ||
return new Q(function(resolve, reject){ | ||
log('exec in'); | ||
/* we need to separate from the main promise chain, since, we don't want it to fail, we need it | ||
to keep going regardless of rejected, since its up to the user on how to deal with the value */ | ||
if (self.context) { | ||
args.push(self.context); | ||
} | ||
Q.try(function (){ | ||
/* Does the exec function return a value or a promise? Doesn't matter */ | ||
/* Pass in the current value as the last parameter, always. */ | ||
if (self.throws === true && typeof context[parsing[0]] !== 'function') { | ||
throw new Error('"exec" function "' + parsing[0] + '" doesnt exists'); | ||
} | ||
var args = parsing.slice(1).concat(currentValue); | ||
return context[condition[0]].apply(context, args); | ||
}) | ||
.then(function successConditional(val) { | ||
/* typecast the result and convert to a boolean */ | ||
val = !!val; | ||
log('ifblock conditional done', val); | ||
if (self.context) { | ||
args.push(self.context); | ||
} | ||
return val; | ||
}) | ||
.catch(function catchConditional(err) { | ||
/* in case the "if" function were rejected, resolve to false */ | ||
log('ifblock conditional fail'); | ||
log('exec try', parsing, context[parsing[0]], args); | ||
if (self.throws === true) { | ||
/*istanbul ignore else */ | ||
if (err instanceof Error) { | ||
reject(err); | ||
} else { | ||
reject(new Error(err)); | ||
} | ||
} else { | ||
return false; | ||
} | ||
return context[parsing[0]].apply(context, args); | ||
}) | ||
.catch(function (err){ | ||
log('exec fail', err); | ||
/* The function threw an exception, we need to continue with the unchanged value */ | ||
if (self.throws === true) { | ||
reject(err); | ||
} else { | ||
resolve(currentValue); | ||
} | ||
}) | ||
.done(function(val){ | ||
log('exec done', val); | ||
return null; | ||
}); | ||
if (val === void 0) { | ||
/* resolve with the current value, the function had no "return" */ | ||
resolve(currentValue); | ||
} else { | ||
/* everything went well, resolve with the new value */ | ||
resolve(val); | ||
} | ||
}); | ||
}); | ||
}; | ||
} | ||
} | ||
}; | ||
}; | ||
function ifblock(parsing){ | ||
log('if out'); | ||
/* return a promise from an ifblock, and add it do the promise chain */ | ||
return function ifblockPromise(currentValue){ | ||
log('if in', currentValue); | ||
return new Q(function(resolve, reject){ | ||
var i, len; | ||
var conditionalelse = function (_else) { | ||
log('ifblock conditionalelse out'); | ||
return function conditionalelsePromise(currentValue) { | ||
log('ifblock conditionalelse after'); | ||
/* try to return a future "else" value, since parser always return a new promise */ | ||
log('ifblock conditionalelse try', _else); | ||
if (typeof parsing['check'] !== 'undefined') { | ||
/* side promise */ | ||
var conditions = Q.resolve(true); | ||
return parser.call(self, _else, currentValue, context) | ||
/* parser never fails */ | ||
.then(function successConditionalElse(val) { | ||
/* only resolve with the new value if it isn't undefined (that means the value had no "return" value */ | ||
/* parser always return the currentValue if there are none */ | ||
log('conditionalelse done', val); | ||
var conditional = function(condition){ | ||
log('conditional out'); | ||
return function conditionalPromise(bool){ | ||
log('conditional in', bool); | ||
/* starts at undefined, that if it doesnt become true, it will be typecasted to boolean false */ | ||
if (bool === false) { | ||
/* previous if check failed, just stop it before calling the other function */ | ||
return Q.resolve(false); | ||
} else { | ||
return Q.try(function(){ | ||
/* the function return a future value, regardless if it's a promise or a primitive value */ | ||
log('conditional try', condition[0]); | ||
if (self.throws === true) { | ||
/* istanbul ignore else */ | ||
if (typeof context[condition[0]] !== 'function') { | ||
throw new Error('"if" function "' + condition[0] + '" doesnt exists'); | ||
} | ||
} | ||
var args = condition.slice(1).concat(currentValue); | ||
return val; | ||
}); | ||
}; | ||
}; | ||
if (self.context) { | ||
args.push(self.context); | ||
} | ||
for (i = 0, len = parsing['check'].length; i < len; i++) { | ||
conditions = conditions.then(conditional(parsing['check'][i])); | ||
} | ||
return context[condition[0]].apply(context, args); | ||
}) | ||
.catch(function(err){ | ||
/* in case the "if" function were rejected, resolve to false */ | ||
log('conditional fail'); | ||
if (self.throws === true) { | ||
throw err; | ||
} else { | ||
return false; | ||
} | ||
}) | ||
.then(function(val){ | ||
/* typecast the result and convert to a boolean */ | ||
val = !!val; | ||
log('conditional done', val); | ||
return val; | ||
}); | ||
} | ||
}; | ||
}; | ||
conditions.then(function successConditions(val) { | ||
log('ifblock check', val); | ||
/* side promise chain, true or false */ | ||
var inpromise = Q.resolve(currentValue); | ||
var conditionalelse = function (_else){ | ||
log('conditionalelse out'); | ||
return function conditionalelsePromise(currentValue){ | ||
log('conditionalelse in'); | ||
/* try to return a future "else" value, since parser always return a new promise */ | ||
log('conditionalelse try', _else); | ||
/* we should either check if the "if" was successiful, if so, execute */ | ||
if (val === true && typeof parsing['exec'] !== 'undefined') { | ||
for (i = 0, len = parsing['exec'].length; i < len; i++) { | ||
inpromise = inpromise.then(exec(parsing['exec'][i])); | ||
} | ||
} else if (val === false && typeof parsing['else'] !== 'undefined') { | ||
inpromise = inpromise.then(conditionalelse(parsing['else'])); | ||
} | ||
return parser.call(self, _else, currentValue, context) | ||
/* parser never fails */ | ||
.then(function(val){ | ||
/* only resolve with the new value if it isn't undefined (that means the value had no "return" value */ | ||
/* parser always return the currentValue if there are none */ | ||
log('conditionalelse done', val); | ||
resolve(inpromise); | ||
return val; | ||
return null; | ||
}); | ||
} else { | ||
if (self.throws === true) { | ||
reject(new Error('Missing "check" in "if"')); | ||
} else { | ||
resolve(currentValue); | ||
} | ||
} | ||
}); | ||
}; | ||
}; | ||
} | ||
for (i = 0, len = parsing['check'].length; i < len; i++) { | ||
conditions = conditions.then(conditional(parsing['check'][i])); | ||
for (i = 0, ilen = obj.length; i < ilen; i++) { | ||
_top = obj[i]; | ||
if (typeof _top['if'] !== 'undefined') { | ||
_inner = _top['if']; | ||
initial = initial.then(ifblock(_inner)); | ||
} | ||
conditions.done(function(val){ | ||
log('check', val); | ||
/* side promise chain, true or false */ | ||
var inpromise = Q.resolve(currentValue); | ||
/* we should either check if the "if" was successiful, if so, execute */ | ||
if (val === true && typeof parsing['exec'] !== 'undefined') { | ||
for (i = 0, len = parsing['exec'].length; i < len; i++) { | ||
inpromise = inpromise.then(exec(parsing['exec'][i])); | ||
if (typeof _top['exec'] !== 'undefined') { | ||
for (j = 0, jlen = _top['exec'].length; j < jlen; j++) { | ||
_inner = _top['exec'][j]; | ||
initial = initial.then(exec(_inner)); | ||
} | ||
} else if (val === false && typeof parsing['else'] !== 'undefined') { | ||
inpromise = inpromise.then(conditionalelse(parsing['else'])); | ||
} | ||
} | ||
} | ||
resolve(inpromise); | ||
}); | ||
} else { | ||
if (self.throws === true) { | ||
reject(new Error('Missing "check" in "if"')); | ||
} else { | ||
resolve(currentValue); | ||
} | ||
} | ||
}); | ||
}; | ||
return initial; | ||
} | ||
for (i = 0, ilen = obj.length; i < ilen; i++) { | ||
_top = obj[i]; | ||
if (typeof _top['if'] !== 'undefined') { | ||
_inner = _top['if']; | ||
initial = initial.then(ifblock(_inner)); | ||
} | ||
if (typeof _top['exec'] !== 'undefined') { | ||
for (j = 0, jlen = _top['exec'].length; j < jlen; j++) { | ||
_inner = _top['exec'][j]; | ||
initial = initial.then(exec(_inner)); | ||
/** | ||
* Creates a new ChainCommander instance | ||
* | ||
* @param {Array|String|Object} obj JSON string or array | ||
* @param {Object} [opts] {{debug: Boolean, throws: Boolean, member: String}} | ||
* @constructor | ||
*/ | ||
function ChainCommander(obj, opts) { | ||
if (!(this instanceof ChainCommander)) { | ||
return new ChainCommander(obj, opts); | ||
} | ||
} | ||
} | ||
return initial; | ||
} | ||
opts = opts || {}; | ||
/** | ||
* Creates a new ChainCommander instance | ||
* | ||
* @param {Array|String|Object} obj JSON string or array | ||
* @param {Object} [opts] {{debug: Boolean, throws: Boolean, member: String}} | ||
* @constructor | ||
*/ | ||
function ChainCommander(obj, opts){ | ||
if (!(this instanceof ChainCommander)) { | ||
return new ChainCommander(obj, opts); | ||
} | ||
/* istanbul ignore next:debug flag */ | ||
this.debug = opts.debug !== void 0 ? opts.debug : false; | ||
this.throws = opts.throws !== void 0 ? opts.throws : false; | ||
this.member = typeof obj === 'object' && | ||
typeof opts.member === 'string' && | ||
typeof obj[opts.member] !== 'undefined' ? opts.member : false; | ||
opts = opts || {}; | ||
if (this.throws && typeof obj === 'object' && typeof opts.member === 'string' && this.member === false) { | ||
throw new Error('Object provided doesnt have member "' + opts.member + '"'); | ||
} | ||
/* istanbul ignore next:debug flag */ | ||
this.debug = opts.debug !== void 0 ? opts.debug : false; | ||
this.throws = opts.throws !== void 0 ? opts.throws : false; | ||
this.member = typeof obj === 'object' && | ||
typeof opts.member === 'string' && | ||
typeof obj[opts.member] !== 'undefined' ? opts.member : false; | ||
if (this.throws && typeof obj === 'object' && typeof opts.member === 'string' && this.member === false) { | ||
throw new Error('Object provided doesnt have member "' + opts.member + '"'); | ||
if (this.member !== false) { | ||
this.context = obj; | ||
this.defs = convert(this.context[this.member]); | ||
} else { | ||
this.defs = convert(obj); | ||
} | ||
} | ||
if (this.member !== false) { | ||
this.context = obj; | ||
this.defs = convert(this.context[this.member]); | ||
} else { | ||
this.defs = convert(obj); | ||
} | ||
} | ||
/** | ||
* Execute all items in chain, with the same context | ||
* | ||
* @param {*} value | ||
* @param {Array} arr Array of ChainCommander or Array of Arrays of ChainCommander | ||
* @param {Object} context | ||
* @param {Function} [tap] Optional array of functions that are executed in order as a side-effect | ||
* | ||
* @returns {Promise} | ||
*/ | ||
ChainCommander.all = function (value, arr, context, tap) { | ||
/** | ||
* Execute all items in chain, with the same context | ||
* | ||
* @param {*} value | ||
* @param {Array} arr Array of ChainCommander or Array of Arrays of ChainCommander | ||
* @param {Object} context | ||
* @param {Function} [tap] Optional array of functions that are executed in order as a side-effect | ||
* | ||
* @returns {Promise} | ||
*/ | ||
ChainCommander.all = function(value, arr, context, tap){ | ||
var result = Q.resolve(value); | ||
var curry = function (item) { | ||
var arr = isArray(item) && item.length; | ||
var | ||
result = Q.resolve(value), | ||
curry = function(item){ | ||
var arr = isArray(item) && item.length; | ||
var tapped = function (r) { | ||
if (tap) { | ||
r.then(function (v) { | ||
tap(v, item.context); | ||
var tapped = function(r){ | ||
if (tap) { | ||
r.then(function(v){ | ||
tap(v, item.context); | ||
}); | ||
} | ||
return r; | ||
}; | ||
return null; | ||
}); | ||
} | ||
return r; | ||
}; | ||
return function allFn(val) { | ||
var r; | ||
if (arr) { | ||
r = Q.resolve(val); | ||
for (var i = 0; i < arr; i++) { | ||
r = r.then(curry(item[i])); | ||
} | ||
return r; | ||
} else if (item instanceof ChainCommander) { | ||
return tapped(item.execute(val, context), item); | ||
} else { | ||
return val; | ||
} | ||
return function allFn(val) { | ||
var r; | ||
if (arr) { | ||
r = Q.resolve(val); | ||
for (var i = 0; i < arr; i++) { | ||
r = r.then(curry(item[i])); | ||
} | ||
return r; | ||
} else if (item instanceof ChainCommander) { | ||
return tapped(item.execute(val, context), item); | ||
} else { | ||
return val; | ||
} | ||
}; | ||
}; | ||
}; | ||
for(var i = 0; i < arr.length; i++) { | ||
result = result.then(curry(arr[i])); | ||
} | ||
for (var i = 0; i < arr.length; i++) { | ||
result = result.then(curry(arr[i])); | ||
} | ||
return result; | ||
}; | ||
return result; | ||
}; | ||
/** | ||
* | ||
* @param {*} initial Any initial value, can be literals, objects and arrays | ||
* @param {Object} context Context to run the chain on | ||
* | ||
* @returns {Promise} | ||
*/ | ||
ChainCommander.prototype.execute = function(initial, context){ | ||
return parser.call(this, this.defs, initial, context); | ||
}; | ||
/** | ||
* | ||
* @param {*} initial Any initial value, can be literals, objects and arrays | ||
* @param {Object} context Context to run the chain on | ||
* | ||
* @returns {Promise} | ||
*/ | ||
ChainCommander.prototype.execute = function (initial, context) { | ||
return parser.call(this, this.defs, initial, context); | ||
}; | ||
return ChainCommander; | ||
return ChainCommander; | ||
}); |
{ | ||
"name" : "chain-commander", | ||
"version": "1.2.1", | ||
"main": "./lib/chain-commander.js", | ||
"description":"Chain commander is a library based on Bluebird promise library, to encapsulate business rules logic in form of javascript objects or JSON.", | ||
"keywords": [ | ||
"workflow", | ||
"flow", | ||
"flowcontrol", | ||
"business logic", | ||
"business rule", | ||
"json", | ||
"pojo", | ||
"chain-of-responsibility", | ||
"chain-of-command", | ||
"promise", | ||
"conditional", | ||
"scriptable", | ||
"json script" | ||
], | ||
"author": "Paulo Cesar", | ||
"license": "MIT", | ||
"repository": { | ||
"type":"git", | ||
"url":"git@github.com:pocesar/js-chain-commander.git" | ||
}, | ||
"scripts": { | ||
"test": "jshint test/test.js lib/chain-commander.js example/app.js && mocha" | ||
}, | ||
"dependencies": { | ||
"bluebird": "*" | ||
}, | ||
"devDependencies": { | ||
"jshint": "*", | ||
"mocha": "*", | ||
"expect.js": "*", | ||
"grunt": "0.4.x", | ||
"grunt-mocha-istanbul":"*", | ||
"coveralls":"*" | ||
} | ||
} | ||
"name": "chain-commander", | ||
"version": "2.0.0", | ||
"main": "./lib/chain-commander.js", | ||
"browser": "./lib/chain-commander.js", | ||
"description": "Chain commander is a library based on Bluebird promise library, to encapsulate business rules logic in form of javascript objects or JSON.", | ||
"keywords": [ | ||
"workflow", | ||
"flow", | ||
"flowcontrol", | ||
"business logic", | ||
"business rule", | ||
"json", | ||
"pojo", | ||
"chain-of-responsibility", | ||
"chain-of-command", | ||
"promise", | ||
"conditional", | ||
"scriptable", | ||
"json script" | ||
], | ||
"author": "Paulo Cesar", | ||
"license": "MIT", | ||
"repository": { | ||
"type": "git", | ||
"url": "git://github.com/pocesar/js-chain-commander.git" | ||
}, | ||
"scripts": { | ||
"test": "jshint test/test.js lib/chain-commander.js example/app.js && mocha" | ||
}, | ||
"peerDependencies": { | ||
"bluebird": ">=2 && <4" | ||
}, | ||
"devDependencies": { | ||
"bluebird": "^3.3.1", | ||
"jshint": "^2.9.1", | ||
"mocha": "^2.4.5", | ||
"chai": "^3.5.0", | ||
"istanbul": "^0.4.2", | ||
"grunt": ">=0.4.5", | ||
"grunt-mocha-istanbul": "git://github.com/pocesar/grunt-mocha-istanbul#issue%2349", | ||
"coveralls": "^2.11.6" | ||
} | ||
} |
@@ -160,13 +160,13 @@ [![Build Status](https://travis-ci.org/pocesar/js-chain-commander.png?branch=master)](https://travis-ci.org/pocesar/js-chain-commander) [![Coverage Status](https://coveralls.io/repos/pocesar/js-chain-commander/badge.png)](https://coveralls.io/r/pocesar/js-chain-commander) | ||
startTimer: function (args, value){ | ||
var d = Q.defer(); | ||
var self = this; | ||
if (this.secondPass === false) { | ||
setTimeout(function (){ | ||
d.resolve('Oops'); // this will be overwritten by the goOn "exec", that will continue from the previous value | ||
}, 1000); | ||
} else { | ||
d.reject(); | ||
} | ||
return d.promise; | ||
return new Q(function(resolve, reject) { | ||
if (self.secondPass === false) { | ||
setTimeout(function (){ | ||
resolve('Oops'); // this will be overwritten by the goOn "exec", that will continue from the previous value | ||
}, 1000); | ||
} else { | ||
reject(); | ||
} | ||
}); | ||
} | ||
@@ -190,3 +190,3 @@ }; | ||
#### `new ChainCommander(Array|String definitions [, Object options])` | ||
### new ChainCommander(definitions: Array|string, options: Object = null) | ||
@@ -196,3 +196,9 @@ Creates a new predefined chain that will execute your code when you call `execute` | ||
```js | ||
var cc = new ChainCommander([{"exec":[["oops"]]}]); | ||
var cc = new ChainCommander([ | ||
{ | ||
"exec":[ | ||
["oops"] | ||
] | ||
} | ||
]); | ||
``` | ||
@@ -213,3 +219,9 @@ | ||
some:'data', | ||
defs:[{"exec":[["oops"]]}] | ||
defs:[ | ||
{ | ||
"exec":[ | ||
["oops"] | ||
] | ||
} | ||
] | ||
}, cc = new ChainCommander(obj, {debug: true, throws: true, member: 'defs'}); | ||
@@ -220,3 +232,3 @@ | ||
#### `ChainCommander.prototype.execute(* initialValue, Object|Function context)` | ||
### ChainCommander.prototype.execute(initialValue: any, context: Object|Function) | ||
@@ -227,14 +239,24 @@ Executes your definitions on the given context. Returns a promise. | ||
var | ||
cc = new ChainCommander([{"exec":[["oops"]]}], {debug: true, throws: true}), | ||
cc = new ChainCommander([ | ||
{ | ||
"exec":[ | ||
["oops"] | ||
] | ||
} | ||
], {debug: true, throws: true}), | ||
context = { | ||
oops: function(){ | ||
oops: function(obj){ | ||
obj.initial = 'b'; | ||
obj.value++; | ||
return obj; | ||
} | ||
}; | ||
cc.execute({initial: 'a', value: 0}, context).done(function(value){ | ||
console.log(value); | ||
}); | ||
cc.execute({initial: 'a', value: 0}, context).done(function(value){ | ||
console.log(value); // {initial: 'b', value: 1} | ||
}); | ||
``` | ||
#### `ChainCommander.all(* value, Array arr, Object|Function context [, Function tap])` | ||
### ChainCommander.all(initialValue: any, arr: ChainCommander[], context: Object|Function, tap: Function = void 0) | ||
@@ -245,2 +267,8 @@ Taking that you have an array with many Chain Commanders, that you want to execute in order, with the same context | ||
```js | ||
var arrayOfCommanders = [ | ||
new ChainCommander(defs), | ||
new ChainCommander(defs2), | ||
new ChainCommander(defs3), | ||
]; | ||
ChainCommander.all('initial value', arrayOfCommanders, context).done(function(value){ | ||
@@ -265,3 +293,3 @@ // initial value transformed | ||
commanderInstance | ||
], context).done(function(value){ | ||
], context).then(function(value){ | ||
// value = 'initial value' transformed | ||
@@ -292,2 +320,1 @@ }); | ||
**Never use any of those in production, since they might generate a lot of unresolved promises.** | ||
@@ -0,4 +1,6 @@ | ||
process.env.NODE_ENV = 'test'; | ||
Q = require('bluebird'); | ||
expect = require('expect.js'); | ||
expect = require('chai').expect; | ||
domain = require('domain'); | ||
ChainCommander = require('../lib/chain-commander')(Q); | ||
ChainCommander = require('../lib/chain-commander')(Q); |
279
test/test.js
@@ -7,3 +7,3 @@ describe('Chain Commander', function (){ | ||
cc = ChainCommander('{}'); | ||
expect(cc.defs).to.eql([ | ||
expect(cc.defs).to.deep.equal([ | ||
{} | ||
@@ -13,3 +13,3 @@ ]); | ||
cc = ChainCommander({}); | ||
expect(cc.defs).to.eql([ | ||
expect(cc.defs).to.deep.equal([ | ||
{} | ||
@@ -19,4 +19,4 @@ ]); | ||
it('if without member check is forgiving', function (done){ | ||
ChainCommander([ | ||
it('if without member check is forgiving', function (){ | ||
return ChainCommander([ | ||
{if: { | ||
@@ -29,7 +29,8 @@ exec: [ | ||
expect(value).to.equal('ok'); | ||
done(); | ||
}).done(); | ||
return null; | ||
}); | ||
}); | ||
it('exec call functions in the context object', function (done){ | ||
it('exec call functions in the context object', function (){ | ||
var cc, obj; | ||
@@ -51,9 +52,10 @@ | ||
cc.execute(10, obj).done(function (value){ | ||
expect(value).to.be(200); | ||
done(); | ||
return cc.execute(10, obj).then(function (value){ | ||
expect(value).to.equal(200); | ||
return null; | ||
}); | ||
}); | ||
it('work with one conditional', function (done){ | ||
it('work with one conditional', function (){ | ||
var cc, obj; | ||
@@ -102,12 +104,13 @@ | ||
cc | ||
return cc | ||
.execute(0, obj) | ||
.done(function (value){ | ||
expect(obj._alterMe).to.be('altered'); | ||
expect(value).to.be(10); | ||
done(); | ||
.then(function (value){ | ||
expect(obj._alterMe).to.equal('altered'); | ||
expect(value).to.equal(10); | ||
return null; | ||
}); | ||
}); | ||
it('deals with exec returning another promise', function (done){ | ||
it('deals with exec returning another promise', function (){ | ||
var cc, obj; | ||
@@ -117,9 +120,7 @@ | ||
returnPromise: function (value){ | ||
var d = Q.pending(); | ||
setTimeout(function (){ | ||
d.resolve({'After timeout: ': value}); | ||
}, 10); | ||
return d.promise; | ||
return new Q(function(resolve) { | ||
setTimeout(function (){ | ||
resolve({'After timeout: ': value}); | ||
}, 10); | ||
}); | ||
} | ||
@@ -132,9 +133,10 @@ }; | ||
cc.execute(0, obj).done(function (val){ | ||
expect(val).to.eql({'After timeout: ': 0}); | ||
done(); | ||
return cc.execute(0, obj).then(function (val){ | ||
expect(val).to.deep.equal({'After timeout: ': 0}); | ||
return null; | ||
}); | ||
}); | ||
it('ifs work with promises', function (done){ | ||
it('ifs work with promises', function (){ | ||
var cc, obj, cmds = [ | ||
@@ -168,9 +170,7 @@ { | ||
checkPromise: function (){ | ||
var d = Q.defer(); | ||
setTimeout(function (){ | ||
d.resolve(true); | ||
}, 5); | ||
return d.promise; | ||
return new Q(function(resolve){ | ||
setTimeout(function (){ | ||
resolve(true); | ||
}, 5); | ||
}); | ||
} | ||
@@ -180,9 +180,10 @@ }; | ||
cc = ChainCommander(cmds); | ||
cc.execute('a', obj).done(function (value){ | ||
expect(value).to.be('abc'); | ||
done(); | ||
return cc.execute('a', obj).then(function (value){ | ||
expect(value).to.equal('abc'); | ||
return null; | ||
}); | ||
}); | ||
it('test the given example', function (done){ | ||
it('test the given example', function (){ | ||
var cc, cmds = [ // It uses arrays because it's the only way it can ensure order. | ||
@@ -271,13 +272,11 @@ { | ||
startTimer: function (args, value){ | ||
var d = Q.defer(); | ||
if (this.secondPass === false) { | ||
setTimeout(function (){ | ||
d.resolve('Oops'); // this will be overwritten by the goOn "exec", that will continue from the previous value | ||
}, 1000); | ||
} else { | ||
d.reject(); | ||
} | ||
return d.promise; | ||
return new Q(function(resolve, reject){ | ||
if (this.secondPass === false) { | ||
setTimeout(function (){ | ||
resolve('Oops'); // this will be overwritten by the goOn "exec", that will continue from the previous value | ||
}, 1000); | ||
} else { | ||
reject(new Error('startTimer')); | ||
} | ||
}); | ||
} | ||
@@ -287,10 +286,9 @@ }; | ||
cc = ChainCommander(cmds); | ||
cc.execute(10, instance).done(function (value){ | ||
expect(value).to.equal(101); | ||
done(); | ||
return cc.execute(10, instance).then(function (value){ | ||
expect(value).to.equal(101); | ||
return null; | ||
}); | ||
}); | ||
it('use objects and change them while passing around', function (done){ | ||
it('use objects and change them while passing around', function (){ | ||
var cc, nobj, context, cmds = [ | ||
@@ -330,10 +328,11 @@ { | ||
cc = ChainCommander(cmds); | ||
cc.execute(nobj, context).done(function (value){ | ||
expect(value).to.be(nobj); | ||
expect(value).to.eql({value1: 2, value2: 3, value3: null}); | ||
done(); | ||
return cc.execute(nobj, context).then(function (value){ | ||
expect(value).to.equal(nobj); | ||
expect(value).to.deep.equal({value1: 2, value2: 3, value3: null}); | ||
return null; | ||
}); | ||
}); | ||
it('deep nested ifs and elses', function (done){ | ||
it('deep nested ifs and elses', function (){ | ||
var cc, context, cmds = [ | ||
@@ -400,9 +399,10 @@ { | ||
cc.execute(0, context).done(function (value){ | ||
expect(value).to.be('done'); | ||
done(); | ||
return cc.execute(0, context).then(function (value){ | ||
expect(value).to.equal('done'); | ||
return null; | ||
}); | ||
}); | ||
it('work on instances', function (done){ | ||
it('work on instances', function (){ | ||
var cc, cmds = [ | ||
@@ -473,10 +473,11 @@ { | ||
cc = ChainCommander(cmds); | ||
cc.execute(0, context).done(function (value){ | ||
expect(value).to.be(4); | ||
expect(context.count).to.be(7); | ||
done(); | ||
return cc.execute(0, context).then(function (value){ | ||
expect(value).to.equal(4); | ||
expect(context.count).to.equal(7); | ||
return null; | ||
}); | ||
}); | ||
it('two if checks', function (done){ | ||
it('two if checks', function (){ | ||
var context, cmds = [ | ||
@@ -513,9 +514,11 @@ { | ||
cc = new ChainCommander(cmds); | ||
cc.execute('', context).then(function (){ | ||
expect(context.called).to.be(false); | ||
expect(context.count).to.be(1); | ||
}).done(done); | ||
return cc.execute('', context).then(function (){ | ||
expect(context.called).to.equal(false); | ||
expect(context.count).to.equal(1); | ||
return null; | ||
}); | ||
}); | ||
it('execute array of chain commanders', function (done){ | ||
it('execute array of chain commanders', function (){ | ||
var context, cmds = [ | ||
@@ -543,15 +546,17 @@ { | ||
ChainCommander.all('wow-', ccs, context).then(function (value){ | ||
return ChainCommander.all('wow-', ccs, context).then(function (value){ | ||
expect(value).to.equal('wow-abcda'); | ||
}).done(done); | ||
return null; | ||
}); | ||
}); | ||
it('passes the last parameter as the calling object', function(done){ | ||
it('passes the last parameter as the calling object', function(){ | ||
var context = { | ||
val: function(add, value, obj) { | ||
expect(obj.exists).to.be(true); | ||
expect(obj.exists).to.equal(true); | ||
return value + add + obj.add; | ||
}, | ||
conditional: function(value, _obj) { | ||
expect(_obj).to.be(obj); | ||
expect(_obj).to.equal(obj); | ||
return _obj.exists; | ||
@@ -567,14 +572,15 @@ }, | ||
expect(cc.member).to.equal('defs'); | ||
expect(cc.context).to.be(obj); | ||
cc.execute('a', context).done(function(val){ | ||
expect(val).to.be('a12'); | ||
done(); | ||
expect(cc.context).to.equal(obj); | ||
return cc.execute('a', context).then(function(val){ | ||
expect(val).to.equal('a12'); | ||
return null; | ||
}); | ||
}); | ||
it('taps to function', function(done){ | ||
it('taps to function', function(){ | ||
var context = { | ||
val: function(add, value, obj) { | ||
if (obj) { | ||
expect(obj.exists).to.be(true); | ||
expect(obj.exists).to.equal(true); | ||
return value + add + obj.add; | ||
@@ -587,3 +593,3 @@ } else { | ||
if (_obj) { | ||
expect(_obj).to.be(obj); | ||
expect(_obj).to.equal(obj); | ||
return _obj.exists; | ||
@@ -606,17 +612,18 @@ } else { | ||
ChainCommander.all('a', ccs, context, function(val, _obj){ | ||
return ChainCommander.all('a', ccs, context, function(val, _obj){ | ||
calls++; | ||
if (_obj) { | ||
expect(_obj).to.be(obj); | ||
expect(_obj).to.equal(obj); | ||
_obj.chumba = true; | ||
} | ||
}).done(function(d){ | ||
expect(d).to.be('a1212112'); | ||
expect(obj.chumba).to.be(true); | ||
expect(calls).to.be(4); | ||
done(); | ||
}).then(function(d){ | ||
expect(d).to.equal('a1212112'); | ||
expect(obj.chumba).to.equal(true); | ||
expect(calls).to.equal(4); | ||
return null; | ||
}); | ||
}); | ||
it('execute array of arrays of chain commanders and ignore non-instances', function (done){ | ||
it('execute array of arrays of chain commanders and ignore non-instances', function (){ | ||
var context, cmds = [ | ||
@@ -643,9 +650,13 @@ { | ||
ChainCommander.all('wow-', ccs, context).then(function (value){ | ||
return ChainCommander.all('wow-', ccs, context).then(function (value){ | ||
expect(value).to.equal('wow-abcda'); | ||
}).done(done); | ||
return null; | ||
}); | ||
}); | ||
it('forgiving on non existant checks and functions', function (done){ | ||
var cc, obj = {thisOneDoes: function (plus, value){ return value + plus; }}, cmds = [ | ||
it('forgiving on non existant checks and functions', function (){ | ||
var cc; | ||
var obj = {thisOneDoes: function (plus, value){ return value + plus; }}; | ||
var cmds = [ | ||
{ | ||
@@ -674,5 +685,6 @@ exec: [ | ||
cc = ChainCommander(cmds); | ||
cc.execute(10, obj).done(function (value){ | ||
expect(value).to.be(11); | ||
done(); | ||
return cc.execute(10, obj).then(function (value){ | ||
expect(value).to.equal(11); | ||
return null; | ||
}); | ||
@@ -682,9 +694,3 @@ }); | ||
it('unforgiving definition', function (done){ | ||
if (typeof domain === 'undefined') { | ||
// not meant for the browser | ||
done(); | ||
return; | ||
} | ||
var execDomain = domain.create(), | ||
cmds = [ | ||
var cmds = [ | ||
{ | ||
@@ -713,43 +719,34 @@ if: { | ||
expect(function(){ | ||
ChainCommander(cmds.slice(thrown-1), {member: 'dummy', throws: true}); | ||
}).to.throw(); | ||
var run = function (){ | ||
var cc; | ||
var cc; | ||
if (thrown === 3) { | ||
execDomain.run(function(){ | ||
ChainCommander(cmds.slice(thrown-1), {member: 'dummy', throws: true}); | ||
}); | ||
} else { | ||
cc = new ChainCommander(cmds.slice(thrown), {throws: true}); | ||
execDomain.run(function (){ | ||
cc.execute(0, {}).done(function (){}); | ||
cc.execute(0, {}).catch(function(err){ | ||
switch (thrown) { | ||
case 0: | ||
expect(err.message).to.equal('"if" function "dontExist" doesnt exists'); | ||
thrown++; | ||
run(); | ||
break; | ||
case 1: | ||
expect(err.message).to.equal('Missing "check" in "if"'); | ||
thrown++; | ||
run(); | ||
break; | ||
case 2: | ||
expect(err.message).to.equal('"exec" function "dontExists" doesnt exists'); | ||
thrown++; | ||
done(); | ||
break; | ||
} | ||
}); | ||
} | ||
}; | ||
execDomain.on('error', function (err){ | ||
switch (thrown) { | ||
case 0: | ||
expect(err.message).to.be('"if" function "dontExist" doesnt exists'); | ||
thrown++; | ||
run(); | ||
break; | ||
case 1: | ||
expect(err.message).to.be('Missing "check" in "if"'); | ||
thrown++; | ||
run(); | ||
break; | ||
case 2: | ||
expect(err.message).to.be('"exec" function "dontExists" doesnt exists'); | ||
thrown++; | ||
run(); | ||
break; | ||
case 3: | ||
expect(err.message).to.be('Object provided doesnt have member "dummy"'); | ||
done(); | ||
break; | ||
} | ||
}); | ||
run(); | ||
}); | ||
}); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
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
Wildcard dependency
QualityPackage has a dependency with a floating version range. This can cause issues if the dependency publishes a new major version.
Found 1 instance in 1 package
29
1841
1
312
162760
8
1
- Removedbluebird@*