@@ -67,7 +67,13 @@ component accessors="true" singleton {
6767 var formatterOptions = duplicate ( definition .options );
6868 structAppend ( formatterOptions , arguments .options , true );
6969
70- return resolveFactory ( definition .factory , definition .properties )( formatterOptions );
70+ var factory = resolveFactory ( definition .factory , definition .properties );
71+
72+ if ( isClosure ( factory ) || isCustomFunction ( factory ) ) {
73+ return factory ( formatterOptions );
74+ }
75+
76+ return factory .toFormatter ( formatterOptions );
7177 }
7278
7379 public boolean function hasReturnFormatter ( required string name ) {
@@ -140,13 +146,10 @@ component accessors="true" singleton {
140146 );
141147 }
142148
143- var wireboxFactory = variables .wirebox .getInstance (
149+ return variables .wirebox .getInstance (
144150 name = arguments .factory ,
145151 initArguments = { " properties" : arguments .properties }
146152 );
147- return function ( options ) {
148- return wireboxFactory .toFormatter ( arguments .options );
149- };
150153 }
151154
152155 if ( ! structKeyExists ( arguments .factory , " toFormatter" ) ) {
@@ -156,10 +159,7 @@ component accessors="true" singleton {
156159 );
157160 }
158161
159- var componentFactory = arguments .factory ;
160- return function ( options ) {
161- return componentFactory .toFormatter ( arguments .options );
162- };
162+ return arguments .factory ;
163163 }
164164
165165}
0 commit comments