@@ -364,20 +364,21 @@ function findDuplicateOutputs(outputs, head, dispatchError, outStrs, outObjs) {
364
364
}
365
365
366
366
function checkInOutOverlap ( out , inputs ) {
367
- const { id : outId , property : outProp } = out ;
367
+ const { id : outId , property : outProp } = out ;
368
368
return inputs . some ( in_ => {
369
- const { id : inId , property : inProp } = in_ ;
370
- if ( outProp !== inProp || typeof outId !== typeof inId ) {
369
+ const { id : inId , property : inProp } = in_ ;
370
+ if ( outProp !== inProp || typeof outId !== typeof inId ) {
371
371
return false ;
372
- }
373
- if ( typeof outId === 'string' ) {
374
- if ( outId === inId ) {
372
+ }
373
+ if ( typeof outId === 'string' ) {
374
+ if ( outId === inId ) {
375
375
return true ;
376
- }
377
- } else if ( wildcardOverlap ( in_ , [ out ] ) ) {
378
- return true ;
379
376
}
380
- } ) ;
377
+ } else if ( wildcardOverlap ( in_ , [ out ] ) ) {
378
+ return true ;
379
+ }
380
+ return false ;
381
+ } ) ;
381
382
}
382
383
383
384
function findMismatchedWildcards ( outputs , inputs , state , head , dispatchError ) {
@@ -738,22 +739,22 @@ export function computeGraphs(dependencies, dispatchError) {
738
739
}
739
740
740
741
/* multiGraph is used only for testing circularity
741
- *
742
+ *
742
743
* Each component+property that is used as an input or output is added as a node
743
744
* to a directed graph with a dependency from each input to each output. The
744
745
* function triggerDefaultState in index.js then checks this graph for circularity.
745
- *
746
+ *
746
747
* In order to allow the same component+property to be both an input and output
747
748
* of the same callback, a two pass approach is used.
748
- *
749
+ *
749
750
* In the first pass, the graph is built up normally with the exception that
750
- * in cases where an output is also an input to the same callback a special
751
+ * in cases where an output is also an input to the same callback a special
751
752
* "output" node is added and the dependencies target this output node instead.
752
753
* For example, if `slider.value` is both an input and an output, then the a new
753
754
* node `slider.value__output` will be added with a dependency from `slider.value`
754
755
* to `slider.value__output`. Splitting the input and output into separate nodes
755
756
* removes the circularity.
756
- *
757
+ *
757
758
* In order to still detect other forms of circularity, it is necessary to do a
758
759
* second pass and add the new output nodes as a dependency in any *other* callbacks
759
760
* where the original node was an input. Continuing the example, any other callback
@@ -762,18 +763,18 @@ export function computeGraphs(dependencies, dispatchError) {
762
763
* and outputs for each callback are stored during the first pass.
763
764
*/
764
765
765
- const outputTag = " __output" ;
766
+ const outputTag = ' __output' ;
766
767
const duplicateOutputs = [ ] ;
767
768
const cbIn = [ ] ;
768
769
const cbOut = [ ] ;
769
770
770
- function addInputToMulti ( inIdProp , outIdProp , firstPass = true ) {
771
+ function addInputToMulti ( inIdProp , outIdProp , firstPass = true ) {
771
772
multiGraph . addNode ( inIdProp ) ;
772
773
multiGraph . addDependency ( inIdProp , outIdProp ) ;
773
774
// only store callback inputs and outputs during the first pass
774
- if ( firstPass ) {
775
- cbIn [ cbIn . length - 1 ] . push ( inIdProp ) ;
776
- cbOut [ cbOut . length - 1 ] . push ( outIdProp ) ;
775
+ if ( firstPass ) {
776
+ cbIn [ cbIn . length - 1 ] . push ( inIdProp ) ;
777
+ cbOut [ cbOut . length - 1 ] . push ( outIdProp ) ;
777
778
}
778
779
}
779
780
@@ -821,10 +822,10 @@ export function computeGraphs(dependencies, dispatchError) {
821
822
if ( typeof outId === 'object' ) {
822
823
const outIdList = makeAllIds ( outId , { } ) ;
823
824
outIdList . forEach ( id => {
824
- let tempOutIdProp = { id, property} ;
825
+ const tempOutIdProp = { id, property} ;
825
826
let outIdName = combineIdAndProp ( tempOutIdProp ) ;
826
827
// if this output is also an input, add `outputTag` to the name
827
- if ( alsoInput ) {
828
+ if ( alsoInput ) {
828
829
duplicateOutputs . push ( tempOutIdProp ) ;
829
830
outIdName += outputTag ;
830
831
}
@@ -834,7 +835,7 @@ export function computeGraphs(dependencies, dispatchError) {
834
835
} else {
835
836
let outIdName = combineIdAndProp ( outIdProp ) ;
836
837
// if this output is also an input, add `outputTag` to the name
837
- if ( alsoInput ) {
838
+ if ( alsoInput ) {
838
839
duplicateOutputs . push ( outIdProp ) ;
839
840
outIdName += outputTag ;
840
841
}
@@ -853,17 +854,17 @@ export function computeGraphs(dependencies, dispatchError) {
853
854
} ) ;
854
855
} ) ;
855
856
856
- // second pass for adding new output nodes as dependencies where needed
857
+ // second pass for adding new output nodes as dependencies where needed
857
858
duplicateOutputs . forEach ( dupeOutIdProp => {
858
- let originalName = combineIdAndProp ( dupeOutIdProp ) ;
859
- let newName = originalName . concat ( outputTag ) ;
860
- for ( var cnt = 0 ; cnt < cbIn . length ; cnt ++ ) {
859
+ const originalName = combineIdAndProp ( dupeOutIdProp ) ;
860
+ const newName = originalName . concat ( outputTag ) ;
861
+ for ( var cnt = 0 ; cnt < cbIn . length ; cnt ++ ) {
861
862
// check if input to the callback
862
- if ( cbIn [ cnt ] . some ( inName => ( inName == originalName ) ) ) {
863
+ if ( cbIn [ cnt ] . some ( inName => inName === originalName ) ) {
863
864
/* make sure it's not also an output of the callback
864
865
* (this will be the original callback)
865
866
*/
866
- if ( ! cbOut [ cnt ] . some ( outName => ( outName == newName ) ) ) {
867
+ if ( ! cbOut [ cnt ] . some ( outName => outName === newName ) ) {
867
868
cbOut [ cnt ] . forEach ( outName => {
868
869
addInputToMulti ( newName , outName , false ) ;
869
870
} ) ;
0 commit comments