mirror of
https://github.com/publiclab/image-sequencer.git
synced 2025-12-13 03:40:03 +01:00
implement basic toString() (#272)
* implement basic toString() Signed-off-by: tech4GT <varun.gupta1798@gmail.com> * refactor Signed-off-by: tech4GT <varun.gupta1798@gmail.com> * remove load-image from string Signed-off-by: tech4GT <varun.gupta1798@gmail.com> * more refactor Signed-off-by: tech4GT <varun.gupta1798@gmail.com> * doing es5 way Signed-off-by: tech4GT <varun.gupta1798@gmail.com> * final refactor Signed-off-by: tech4GT <varun.gupta1798@gmail.com> * refactor Signed-off-by: tech4GT <varun.gupta1798@gmail.com> * remove if else from map Signed-off-by: tech4GT <varun.gupta1798@gmail.com> * fix function call Signed-off-by: tech4GT <varun.gupta1798@gmail.com> * add sequencer.steps Signed-off-by: tech4GT <varun.gupta1798@gmail.com> * add tests for toString and stepToString Signed-off-by: tech4GT <varun.gupta1798@gmail.com> * fix toString final Signed-off-by: tech4GT <varun.gupta1798@gmail.com> * fix build failing Signed-off-by: tech4GT <varun.gupta1798@gmail.com> * refactored and fix tests Signed-off-by: tech4GT <varun.gupta1798@gmail.com> * refactor tests Signed-off-by: tech4GT <varun.gupta1798@gmail.com>
This commit is contained in:
committed by
Jeffrey Warren
parent
be810fb9c4
commit
ac183205f0
@@ -121,7 +121,7 @@ ImageSequencer = function ImageSequencer(options) {
|
||||
progressObj = spinnerObj
|
||||
delete arguments['0']
|
||||
}
|
||||
|
||||
|
||||
var this_ = (this.name == "ImageSequencer")?this:this.sequencer;
|
||||
var args = (this.name == "ImageSequencer")?[]:[this.images];
|
||||
for (var arg in arguments) args.push(copy(arguments[arg]));
|
||||
@@ -198,6 +198,24 @@ ImageSequencer = function ImageSequencer(options) {
|
||||
return modulesdata;
|
||||
}
|
||||
|
||||
function toString(step) {
|
||||
if(step) {
|
||||
return stepToString(step);
|
||||
} else {
|
||||
return copy(this.images.image1.steps).map(stepToString).slice(1).join(',');
|
||||
}
|
||||
}
|
||||
|
||||
function stepToString(step) {
|
||||
let inputs = copy(modulesInfo(step.options.name).inputs);
|
||||
inputs = inputs || {};
|
||||
|
||||
for(let input in inputs) inputs[input] = step.options[input] || inputs[input].default;
|
||||
|
||||
var configurations = Object.keys(inputs).map(key=>key + ':' + inputs[key]).join(',');
|
||||
return `${step.options.name}(${configurations})`;
|
||||
}
|
||||
|
||||
return {
|
||||
//literals and objects
|
||||
name: "ImageSequencer",
|
||||
@@ -218,12 +236,14 @@ ImageSequencer = function ImageSequencer(options) {
|
||||
setUI: setUI,
|
||||
exportBin: exportBin,
|
||||
modulesInfo: modulesInfo,
|
||||
toString: toString,
|
||||
stepToString: stepToString,
|
||||
|
||||
//other functions
|
||||
log: log,
|
||||
objTypeOf: objTypeOf,
|
||||
copy: copy,
|
||||
|
||||
|
||||
setInputStep: require('./ui/SetInputStep')(sequencer)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user